/* Nano Banana Theme: Dark Space + Vibrant Gold */

/* Base Styles - Prevent white background from showing */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-width: 480px;
    height: 100%;
    background: #0a0a1a;
    /* Dark space background */
    overflow: hidden;
}

:root {
    --wheel-size: min(450px, 95vw, 70vh);
}

.controls-container {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    /* Width and Top will be set dynamically by JS to match slot body */
    width: max-content;
    min-width: 800px;
    /* Ensure 3-column layout is formed before scaling */
    top: 0;
    z-index: 100;
}

body.ui-booting .controls-container {
    opacity: 0;
    pointer-events: none;
}

#bottom-bar {
    background: rgba(225, 225, 241, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 30px;
    /* Increased padding by ~30% */
    border-radius: 60px;
    /* Slightly rounder */
    display: flex;
    flex-direction: column;
    /* Stack rows vertically */
    align-items: center;
    justify-content: center;
    gap: 25px;
    /* Increased gap */
    border: 1px solid rgba(255, 215, 0, 0.06);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6), inset 0 0 10px rgba(255, 215, 0, 0.05);
}

/* Row Layouts */
.control-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spin-mult-row {
    gap: 18px;
    margin-bottom: -40px;
    transform: translateY(50px);
    z-index: 15;
}

.spin-mult-btn {
    width: 94px;
    height: 94px;
    border: 1px solid rgba(220, 235, 255, 0.45);
    border-radius: 22px;
    background:
        linear-gradient(140deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.04) 45%, rgba(255, 255, 255, 0.08) 100%),
        linear-gradient(180deg, rgba(60, 85, 150, 0.34), rgba(18, 28, 64, 0.28));
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -8px 14px rgba(8, 14, 40, 0.28),
        0 8px 18px rgba(0, 0, 0, 0.28);
}

.spin-mult-btn::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 8px;
    width: calc(100% - 16px);
    height: 34px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.08));
    pointer-events: none;
}

.spin-mult-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.58),
        inset 0 -8px 14px rgba(8, 14, 40, 0.28),
        0 10px 20px rgba(0, 0, 0, 0.34);
}

.spin-mult-btn:active {
    transform: translateY(1px) scale(0.98);
}

.spin-mult-display {
    min-width: 286px;
    text-align: center;
    padding: 16px 26px;
    border-radius: 999px;
    border: 1px solid rgba(255, 227, 130, 0.62);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 40%),
        linear-gradient(180deg, rgba(42, 52, 125, 0.92), rgba(10, 15, 42, 0.92));
    color: #ffe38a;
    font-family: 'Outfit', sans-serif;
    font-size: 44px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.58);
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 2px 7px rgba(255, 255, 255, 0.2),
        inset 0 -7px 14px rgba(8, 11, 35, 0.52),
        0 8px 18px rgba(0, 0, 0, 0.42),
        0 0 20px rgba(255, 221, 120, 0.16);
}

.spin-mult-display::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 7%;
    width: 86%;
    height: 38%;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.04));
    pointer-events: none;
}

/* Spin Button - Image Based (2x Size) */
#spin-btn {
    position: relative;
    background: url('./assets/buttons/btn_spin_main.png') no-repeat center center;
    background-size: contain;
    border: none;
    padding: 0;
    font-size: 80px;
    width: 600px;
    /* 2x size */
    height: 600px;
    /* 2x size */
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
}

#spin-btn .spin-text-main {
    position: absolute;
    top: 45%;
    left: 48%;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 2px 6px rgba(60, 60, 60, 0.75);
    transform: translate(-50%, -50%) translateY(-50px) translateX(10px);
    z-index: 2;
    line-height: 1;
    pointer-events: none;
}

#spin-btn:hover:not(:disabled) {
    transform: translateY(-5px) scale(1.02);
    filter: brightness(1.1) drop-shadow(0 0 20px rgba(255, 50, 50, 0.6));
    background: url('./assets/buttons/btn_spin_main.png') no-repeat center center;
    background-size: contain;
    box-shadow: none;
}

#spin-btn:active:not(:disabled) {
    transform: translateY(3px) scale(0.98);
    filter: brightness(0.9) drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
    box-shadow: none;
}

/* Remove unused sections */
.top-row,
.bet-section,
.balance-section,
.win-section {
    display: none;
}

/* Energy Gauge Styling */
.bottom-gauge-row {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
    transform: translateY(-150px);
    align-items: center;
    gap: 12px;
}

#energy-gauge-container {
    position: relative;
    width: 450px;
    height: 90px;
    /* Adjust height based on image aspect ratio if needed, keeping it slim */
    background: transparent;
    border-radius: 45px;
    overflow: hidden;
    box-shadow: none;
    border: none;
    z-index: 1;
}

.gauge-bg {
    position: absolute;
    top: 0;
    left: 10px;
    width: 100%;
    height: 100%;
    background: transparent;
    background-size: 90% 70%;
    z-index: 1;
}

#energy-gauge-fill {
    position: absolute;
    top: 12px;
    left: 12px;
    width: calc(100% - 2px);
    /* JS will update this width % */
    height: calc(100% - 24px);
    background: url('./assets/slots/common/progress_blue.png') no-repeat left center;
    background-size: 150% 200%;
    background-position: center;
    /* or 100% 100% depending on image nature */
    z-index: 2;
    transition: width 0.3s ease-out;
    transform-origin: left center;
    transform: scaleX(var(--gauge-scale, 1));
}

.energy-icon {
    width: 90px;
    height: 112px;
    margin-right: -60px;
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
}

.gauge-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

#spin-btn:disabled {
    filter: grayscale(1) brightness(0.7);
    cursor: not-allowed;
    transform: scale(0.95);
}


/* Win Overlay (Existing logic kept, styled slightly) */
/* Win Overlay (Existing logic kept, styled slightly) */
#win-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    /* Use CSS variable for responsive scaling */
    transform: translate(-50%, -50%) scale(var(--win-scale, 1));
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s;
}

.win-frame-bg {
    /* 60% of original (700x500) */
    width: 420px;
    height: 300px;
    background-image: url('/hubble/assets/slots/common/ui_win_frame.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.5));
}

.overlay-content {
    position: absolute;
    top: 70%;
    left: 50%;
    transform: translate(-50%, -10%);
    text-align: center;
    color: #fff;
    width: 100%;
}

#overlay-win-amount {
    font-family: 'Outfit', sans-serif;
    /* 60% of 90px */
    font-size: 54px;
    margin: 0;
    font-weight: 900;
    background: linear-gradient(to bottom, #fff, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 0px rgba(0, 0, 0, 0.5));
}

#overlay-win-details {
    /* 60% of 24px */
    font-size: 14px;
    color: #FFD700;
    font-weight: 700;
    letter-spacing: 2px;
    margin-top: -10px;
    /* Adjusted margin */
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
}

.hidden {
    display: none !important;
    opacity: 0 !important;
}

.show {
    display: block !important;
    opacity: 1 !important;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% {
        /* Start at half of the target scale */
        transform: translate(-50%, -50%) scale(calc(var(--win-scale, 1) * 0.5));
        opacity: 0;
    }

    100% {
        /* End at strictly the target scale */
        transform: translate(-50%, -50%) scale(var(--win-scale, 1));
        opacity: 1;
    }
}

/* ==================== SIDEBAR LAYOUT ==================== */
.sidebar {
    position: fixed;
    top: 70px;
    /* Below Top Bar */
    bottom: 0;
    bottom: 0;
    width: 10%;
    min-width: 0;
    /* Ensure buttons fit */
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-top: 20px;
    padding-bottom: 20px;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bounce effect */
}

.sidebar.left {
    left: 0;
}

.sidebar.right {
    right: 0;
}

.sidebar.hidden-side.left {
    transform: translateX(-120%);
}

.sidebar.hidden-side.right {
    transform: translateX(120%);
}

.sidebar.visible-side {
    transform: translateX(0) !important;
}

/* Keep sidebar symbols centered */
#sound-toggle-wrapper,
#card-reveal-wrapper,
#body-toggle-wrapper {
    transform: translateX(0);
}

.sidebar-item {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
    padding-left: 0;
    padding-right: 0;
}

/* ==================== REFACOR ICONS/BUTTONS ==================== */

/* Slot Body Toggle Button */
#body-toggle-btn {
    position: relative;
    /* Reset Fixed */
    bottom: auto;
    right: auto;
    /* Push to bottom via wrapper */
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 30px;
    color: #FFD700;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 200;
    white-space: nowrap;
    transform: scale(0.9);
    /* Scale down slightly for 10% width */
}

#body-toggle-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
    transform: scale(0.95);
}

/* Sound Toggle Button */
#sound-toggle-btn {
    position: relative;
    top: auto;
    right: auto;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 70, 70, 0.5);
    border-radius: 20px;
    color: #ff6b6b;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 2001;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

#sound-toggle-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.1);
}

#sound-toggle-btn.on {
    border-color: rgba(255, 215, 0, 0.5);
    color: #FFD700;
}

#card-reveal-btn {
    position: relative;
    top: auto;
    right: auto;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: 20px;
    color: #FFD700;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 200;
    white-space: nowrap;
}

#card-reveal-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 215, 0, 0.2);
}

/* Lucky Icon */
#lucky-icon {
    position: relative;
    top: auto;
    right: auto;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 160;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

#lucky-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#lucky-icon:hover {
    transform: scale(1.15);
}

/* Wheel Bonus Icon */
#wheel-bonus-icon {
    position: relative;
    top: auto;
    right: auto;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 150;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

#wheel-bonus-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: wheelSpinBounce 4s ease-in-out infinite;
}

#wheel-bonus-icon:hover {
    transform: scale(1.15);
}

#wheel-bonus-icon:hover img {
    animation: wheelSpinFast 0.5s linear infinite;
}

/* Wheel Spin Animation with Bounce Effect */
@keyframes wheelSpinBounce {
    0% {
        transform: rotate(0deg) scale(1);
    }

    20% {
        transform: rotate(360deg) scale(1);
    }

    /* First bounce up */
    25% {
        transform: rotate(360deg) scale(1.15);
    }

    /* First bounce down */
    30% {
        transform: rotate(360deg) scale(0.95);
    }

    /* Second bounce up */
    35% {
        transform: rotate(360deg) scale(1.08);
    }

    /* Settle */
    40% {
        transform: rotate(360deg) scale(1);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes wheelSpinFast {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ==================== WHEEL PAGE STYLES ==================== */

/* Page Container (shared between pages) */
.page-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-container.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-container.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Stage Point Page needs higher z-index to be above sidebars (z-index: 1000) */
#stage-point-page {
    z-index: 1500 !important;
}



/* Page Sidebar - positioned in the 10% padding area */
.page-sidebar {
    position: absolute;
    top: 80px;
    /* Below global top bar */
    bottom: 0;
    width: 10%;
    z-index: 100 !important;
    /* Match controls-container layer */
    pointer-events: none;

    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
    gap: 20px;
}

.page-sidebar.left {
    left: 1%;
    /* Match top bar margin */
}

.page-sidebar.right {
    right: 1%;
    /* Match top bar margin */
}

/* Ensure buttons inside sidebar are clickable */
.page-sidebar button {
    pointer-events: auto;
}

/* Unified Back Button Styles for Sidebar Placement */
.page-sidebar .back-btn-wheel,
.page-sidebar .back-btn-stage,
.page-sidebar .back-btn-dice,
.stage-side-area .back-btn-simple {
    /* Override fixed positioning */
    position: relative !important;
    top: auto !important;
    left: auto !important;

    /* Unified size */
    width: 60px;
    height: 40px;
    padding: 8px 12px;

    /* Simple text-based styling (no background image) */
    background: rgba(0, 0, 0, 0.4);
    background-image: none !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.page-sidebar .back-btn-wheel:hover,
.page-sidebar .back-btn-stage:hover,
.page-sidebar .back-btn-dice:hover,
.stage-side-area .back-btn-simple:hover {
    transform: scale(1.05);
    background: rgba(0, 0, 0, 0.6);
}

.page-sidebar .back-btn-wheel span,
.page-sidebar .back-btn-stage span,
.page-sidebar .back-btn-dice span,
.stage-side-area .back-btn-simple span {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    font-size: 12px;
}

/* Hide main game sidebars when ANY bonus page is visible */
#stage-point-page.visible~.sidebar,
body:has(#stage-point-page.visible) .sidebar,
#wheel-page.visible~.sidebar,
body:has(#wheel-page.visible) .sidebar,
#stage-page.visible~.sidebar,
body:has(#stage-page.visible) .sidebar,
#dice-page.visible~.sidebar,
body:has(#dice-page.visible) .sidebar {
    display: none !important;
}

/* Night Sky Background Base */
.wheel-bg-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
            #0a0a1a 0%,
            #10102a 30%,
            #1a1a40 60%,
            #252550 100%);
    z-index: 0;
}

/* Moon Element */
.wheel-bg-base::after {
    content: '';
    position: absolute;
    top: 8%;
    right: 12%;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 35% 35%,
            #fffef0 0%,
            #f5f0d0 30%,
            #e8e0b0 60%,
            rgba(255, 255, 220, 0.3) 80%,
            transparent 100%);
    border-radius: 50%;
    box-shadow:
        0 0 20px 8px rgba(255, 255, 200, 0.3),
        0 0 40px 15px rgba(255, 255, 180, 0.15),
        0 0 60px 25px rgba(255, 255, 150, 0.08);
    animation: moonGlow 6s ease-in-out infinite;
}

@keyframes moonGlow {

    0%,
    100% {
        box-shadow:
            0 0 20px 8px rgba(255, 255, 200, 0.3),
            0 0 40px 15px rgba(255, 255, 180, 0.15),
            0 0 60px 25px rgba(255, 255, 150, 0.08);
    }

    50% {
        box-shadow:
            0 0 25px 10px rgba(255, 255, 200, 0.4),
            0 0 50px 20px rgba(255, 255, 180, 0.2),
            0 0 80px 35px rgba(255, 255, 150, 0.12);
    }
}

/* Night Cloud Layer - Subtle dark clouds */
.night-cloud-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    /* Dark Cloud version using CSS filter on original asset */
    background-image: url('./assets/slots/common/cloud_back.png');
    background-size: cover;
    background-repeat: repeat-x;
    /* Allow horizontal repeating for drift */
    z-index: 0;
    opacity: 0.7;
    /* Darken and shift hue to blue/night style */
    filter: brightness(0.3) contrast(1.2) hue-rotate(180deg) sepia(0.3) saturate(1.2);
    animation: driftClouds 60s linear infinite;

}

@keyframes driftClouds {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Star Layers (Shared Base) */
.star-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: repeat;
    z-index: 1;
}

/* Star Layer 1 - Back (Small, Slow) */
.star-layer-1 {
    background:
        radial-gradient(1px 1px at 10% 15%, rgba(255, 255, 255, 0.8) 50%, transparent 100%),
        radial-gradient(1px 1px at 25% 35%, rgba(255, 255, 255, 0.6) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 40% 10%, rgba(255, 255, 255, 0.9) 50%, transparent 100%),
        radial-gradient(1px 1px at 55% 45%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
        radial-gradient(1px 1px at 70% 20%, rgba(255, 255, 255, 0.7) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 85% 55%, rgba(255, 255, 255, 0.6) 50%, transparent 100%),
        radial-gradient(1px 1px at 15% 70%, rgba(255, 255, 255, 0.8) 50%, transparent 100%),
        radial-gradient(1px 1px at 45% 80%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
        radial-gradient(1px 1px at 75% 75%, rgba(255, 255, 255, 0.7) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 90% 85%, rgba(255, 255, 255, 0.6) 50%, transparent 100%);
    animation: twinkle1 4s ease-in-out infinite;
    opacity: 0.7;
}

/* Star Layer 2 - Middle (Medium, Medium Speed) */
.star-layer-2 {
    background:
        radial-gradient(2px 2px at 5% 25%, rgba(200, 220, 255, 0.9) 50%, transparent 100%),
        radial-gradient(2px 2px at 20% 50%, rgba(255, 255, 200, 0.8) 50%, transparent 100%),
        radial-gradient(2.5px 2.5px at 35% 30%, rgba(255, 255, 255, 1) 50%, transparent 100%),
        radial-gradient(2px 2px at 50% 60%, rgba(200, 200, 255, 0.7) 50%, transparent 100%),
        radial-gradient(2px 2px at 65% 40%, rgba(255, 255, 220, 0.9) 50%, transparent 100%),
        radial-gradient(2.5px 2.5px at 80% 70%, rgba(255, 255, 255, 1) 50%, transparent 100%),
        radial-gradient(2px 2px at 30% 85%, rgba(220, 220, 255, 0.8) 50%, transparent 100%),
        radial-gradient(2px 2px at 60% 90%, rgba(255, 255, 200, 0.7) 50%, transparent 100%);
    animation: twinkle2 2.5s ease-in-out infinite;
    opacity: 0.85;
}

/* Star Layer 3 - Disabled (Reduced to 2 layers) */
.star-layer-3 {
    display: none;
}

/* Twinkling Animations */
@keyframes twinkle1 {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.9;
        transform: scale(1.1);
    }
}

@keyframes twinkle2 {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

@keyframes twinkle3 {

    0%,
    100% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.25);
    }
}

/* Back Button for Wheel Page */
.back-btn-wheel {
    position: fixed;
    top: 10px;
    left: 30px;
    padding: 0;
    width: 160px;
    height: 160px;
    background: url('./assets/buttons/btn_back.png') no-repeat center center;
    background-size: contain;
    border: none;
    border-radius: 0;
    color: #ffffff;
    font-size: 19.6px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: none;
    transition: transform 0.2s ease, filter 0.2s;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.4));
}

.back-btn-wheel span {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.back-btn-wheel:hover {
    background: url('./assets/buttons/btn_back.png') no-repeat center center;
    background-size: contain;
    border: none;
    transform: scale(1.1);
    box-shadow: none;
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

/* ==================== WHEEL GAME STYLES ==================== */

/* Top Info Bar */
.wheel-info-bar {
    position: fixed;
    top: 130px;
    right: 30px;
    display: flex;
    gap: 20px;
    z-index: 600;
}

.wheel-info-item {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 15px;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(10px);
}

.info-label {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.info-value {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #ffd700;
}

/* Wheel Game Container */
.wheel-game-container {
    position: absolute;
    top: calc(50% - 50px);
    left: 50%;
    transform: translate(-50%, -50%);
    transform-style: flat;
    perspective: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

/* Wheel Pointer */
.wheel-pointer {
    position: relative;
    z-index: 20;
    margin-bottom: -30px;
}

.wheel-pointer img {
    width: 60px;
    height: auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

/* Ticking Animation for Pointer */
@keyframes tick-animation {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(-25deg);
        /* Kick back */
    }

    100% {
        transform: rotate(0deg);
        /* Return */
    }
}

.wheel-pointer img.tick {
    animation: tick-animation 0.15s ease-out;
    transform-origin: 50% 10%;
    /* Pivot from the top */
}

/* Spinning Wheel */
.wheel-spinner {
    position: relative;
    transition: transform 3s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    transform-style: flat;
    width: var(--wheel-size, 450px);
    height: var(--wheel-size, 450px);
}

.wheel-image {
    width: 100%;
    height: 100%;
    /* Explicitly set height to match width */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 25px rgba(0, 0, 0, 0.6));
    /* Removed transform to prevent wobble during rotation */
}

/* Wheel Sections Overlay */

.wheel-sections {

    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.wheel-section {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 50%;
    transform-origin: 0% 0%;
    /* Remove padding/flex centering to use absolute positioning */
    display: block;
    padding: 0;
    /* Reset geometry to 0x0 at center for easier pivot math */
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    overflow: visible;
}

/* 
   각 섹션의 가상 '팔(Arm)'을 휠 중앙에서 해당 섹션의 '정중앙(Center of Wedge)'을 향해 회전시킵니다.
   - 0번 섹션 (0~45도): 중앙은 22.5도 (12시 기준)
   - CSS 0도 = 3시 방향 (Right)
   - 12시는 -90도
   - 따라서 0번 섹션 각도 = -90 + 22.5 = -67.5도
   - 이후 섹션마다 +45도씩 증가
*/

.wheel-section[data-index="0"] {
    transform: rotate(-67.5deg);
}

.wheel-section[data-index="1"] {
    transform: rotate(-22.5deg);
}

.wheel-section[data-index="2"] {
    transform: rotate(22.5deg);
}

.wheel-section[data-index="3"] {
    transform: rotate(67.5deg);
}

.wheel-section[data-index="4"] {
    transform: rotate(112.5deg);
}

.wheel-section[data-index="5"] {
    transform: rotate(157.5deg);
}

.wheel-section[data-index="6"] {
    transform: rotate(202.5deg);
}

.wheel-section[data-index="7"] {
    transform: rotate(247.5deg);
}

.wheel-section span {
    position: absolute;
    top: 0;
    left: 50px;
    /* Radius distance: Increased to 60px (Move out of inner hub overlap) */
    transform: translateY(-50%);
    /* Center vertically on the arm */

    display: flex;
    align-items: center;
    justify-content: center;
    /* Explicitly center content */
    /* gap property removed for compatibility/robustness */

    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    /* 20px as requested */
    font-weight: 800;
    color: #fff;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    line-height: normal;
    /* Use normal line-height for better font centering */
}

.wheel-section .ws-icon {
    font-size: 0;
    /* 2배로 유지 */
    display: flex;
    align-items: center;
    margin-left: 80px;
    /* Gap 대신 Margin 사용 for robust spacing */
}

.wheel-section .ws-icon img {
    width: 70px;
    height: 70px;
}

.wheel-section .ws-value {
    text-align: center;
    display: flex;
    align-items: center;
    height: 100%;
}

/* Wheel Spin Controls */
.wheel-spin-controls {
    position: absolute;
    top: calc(45% + 310px);
    /* 45% + 225px(half wheel) + 35px margin */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 600;
}

/* Wheel Spin Button */
.wheel-spin-btn {
    position: static;
    width: 150px;
    height: 100px;
    background: linear-gradient(180deg, #ff4444 0%, #cc2222 50%, #aa1111 100%);
    border: none;
    border-radius: 24px;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow:
        0 4px 0 #881111,
        0 6px 15px rgba(0, 0, 0, 0.5),
        inset 0 3px 10px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.wheel-mult-btn {
    min-width: 62px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.6);
    background: linear-gradient(180deg, rgba(255, 232, 170, 0.95) 0%, rgba(255, 191, 90, 0.95) 100%);
    color: #3a2400;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    box-shadow:
        0 3px 0 rgba(150, 90, 10, 0.7),
        0 6px 12px rgba(0, 0, 0, 0.35),
        inset 0 1px 2px rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
}

.wheel-mult-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.wheel-mult-btn:active {
    transform: translateY(1px);
    box-shadow:
        0 1px 0 rgba(150, 90, 10, 0.7),
        0 3px 6px rgba(0, 0, 0, 0.35),
        inset 0 1px 2px rgba(255, 255, 255, 0.7);
}

.wheel-spin-btn:hover {
    transform: translateY(-3px);
    box-shadow:
        0 5.5px 0 #881111,
        0 7.5px 20px rgba(0, 0, 0, 0.6),
        inset 0 3px 10px rgba(255, 255, 255, 0.3);
}

.wheel-spin-btn:active {
    transform: translateY(4px);
    box-shadow:
        0 2px 0 #881111,
        0 3px 10px rgba(0, 0, 0, 0.4),
        inset 0 3px 10px rgba(255, 255, 255, 0.3);
}

.wheel-spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spin-text {
    font-family: 'Outfit', sans-serif;
    font-size: 25px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.spin-cost {
    font-family: 'Outfit', sans-serif;
    font-size: 25px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.gem-icon {
    width: 36px;
    height: 36px;
    vertical-align: middle;
    margin-right: 6px;
}

.wheel-bonus-icon {
    width: 36px;
    height: 36px;
    vertical-align: middle;
    margin-right: 6px;
}

.wheel-spin-btn.free .spin-cost {
    color: #4ade80;
}

/* Result Popup */
.wheel-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.wheel-popup.hidden {
    opacity: 0;
    pointer-events: none;
}

.wheel-popup-content {
    background: linear-gradient(180deg, #2a2a50 0%, #1a1a35 100%);
    border: 3px solid #ffd700;
    border-radius: 30px;
    padding: 40px 60px;
    text-align: center;
    box-shadow:
        0 0 50px rgba(255, 215, 0, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.8);
    animation: popupBounce 0.4s ease-out;
}

@keyframes popupBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-title {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: #ffd700;
    margin: 0 0 30px 0;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.popup-reward {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.reward-icon {
    font-size: 48px;
}

.reward-value {
    font-family: 'Outfit', sans-serif;
    font-size: 64px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.reward-label {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 30px 0;
}

.popup-close-btn {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
    border: none;
    border-radius: 25px;
    padding: 15px 50px;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 0 #16a34a, 0 6px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.popup-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #16a34a, 0 8px 25px rgba(0, 0, 0, 0.5);
}

.popup-close-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #16a34a, 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* ==================== STAGE PAGE STYLES ==================== */

/* Stage Page Background */
.stage-bg-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Use bg_cookie.png as requested */
    background-image: url('./assets/slots/common/bg_cookie.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
    /* Allow clicks to pass through */
}

/* Back Button for Stage Page (Same style as Wheel Back Button) */
/* Back Button for Stage Page */
.back-btn-stage {
    position: fixed;
    top: 10px;
    left: 30px;
    padding: 0;
    width: 160px;
    height: 160px;
    background: url('./assets/buttons/btn_back.png') no-repeat center center;
    background-size: contain;
    border: none;
    border-radius: 0;
    color: #ffffff;
    font-size: 19.6px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: none;
    transition: transform 0.2s ease, filter 0.2s;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.4));
}

.back-btn-stage span {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.back-btn-stage:hover {
    background: url('./assets/buttons/btn_back.png') no-repeat center center;
    background-size: contain;
    border: none;
    transform: scale(1.1);
    box-shadow: none;
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

/* Stage Bonus Icon (Similar to Wheel Icon) */
#stage-bonus-icon {
    position: relative;
    top: auto;
    right: auto;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 150;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

#stage-bonus-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#stage-bonus-icon:hover {
    transform: scale(1.15);
}

/* STAGE PAGE CONTENT */
.stage-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    z-index: 10;
}

/* Character Gauge Container */
.stage-char-container {
    position: relative;
    width: 300px;
    height: 400px;
    /* Increased height for taller aspect ratios */
    margin-bottom: 20px;
    /* Spacing for button */
}

/* Common Image Handling */
.stage-char-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Silhouette (Background) */
.stage-char-silhouette {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.6;
    filter: brightness(0);
    /* Make it black */
}

/* Filled (Foreground) - Reveal Effect */
.stage-char-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    clip-path: inset(100% 0 0 0);
    /* Start hidden */
    transition: clip-path 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 
   During filling: Image is black (Silhouette fill)
   We target the IMG inside .stage-char-fill 
*/
.stage-char-fill img {
    filter: brightness(0) opacity(0.9);
    transition: filter 1.5s ease-in-out;
}

/* Completed State Animation */
.stage-char-fill.completed {
    clip-path: inset(0 0 0 0) !important;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
    animation: charBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* When completed, reveal original color */
.stage-char-fill.completed img {
    filter: brightness(1) opacity(1);
    /* Restore color */
}

@keyframes charBounce {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Build Button */
.stage-btn {
    position: relative;
    padding: 15px 40px;
    background: linear-gradient(180deg, #FFD700 0%, #FF8C00 100%);
    border: 4px solid #FFF;
    border-radius: 50px;
    box-shadow: 0 10px 0 #B85C00, 0 10px 20px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 220px;
}

.stage-btn:active {
    transform: translateY(5px);
    box-shadow: 0 5px 0 #B85C00, 0 5px 10px rgba(0, 0, 0, 0.5);
}

.stage-btn .btn-text {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 900;
    color: #FFF;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.stage-btn .btn-sub {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #FFF;
    opacity: 0.9;
}

/* Effect Placeholders (Simple CSS implementations) */
.effect-cloud {
    position: absolute;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #fff 60%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: cloudPoof 0.8s ease-out forwards;
}

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

    100% {
        transform: scale(1.5) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

/* Hammer Effect */
.effect-hammer {
    position: absolute;
    width: 80px;
    height: 80px;
    background-image: url('/hubble/assets/slots/common/hammer.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 20;
    transform-origin: bottom right;
    /* Pivots like hitting */
    animation: hammerStrike 0.5s ease-in-out forwards;
}

@keyframes hammerStrike {
    0% {
        transform: rotate(45deg) translate(20px, -20px);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    50% {
        transform: rotate(-45deg) translate(0, 0);
        /* Hit */
    }

    70% {
        transform: rotate(-45deg) translate(0, 0);
        opacity: 1;
    }

    100% {
        transform: rotate(-45deg) translate(0, 0);
        opacity: 0;
    }
}

/* Twinkle Effect */
.effect-twinkle {
    position: absolute;
    width: 40px;
    height: 40px;
    background-image: url('/hubble/assets/slots/common/twinkle.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 21;
    animation: twinkleSparkle 0.8s ease-out forwards;
}

@keyframes twinkleSparkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.2) rotate(90deg);
        opacity: 1;
    }

    100% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
}

/* Stage Effects Overlay (Full Screen) */
#stage-effects-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through */
    z-index: 100;
    /* On top of character and buttons */
    overflow: hidden;
}

/* Ensure canvas inside is interactive if needed, but for reveal maybe not? */
#stage-effects-container canvas {
    pointer-events: auto;
}

/* Reposition Stage Action Button below Sound Button */
#stage-action-btn {
    position: absolute;
    top: 400px;
    right: 30px;
    /* Reset margins/centering if any */
    margin: 0;
    z-index: 200;
    /* Ensure above effects overlay (100) and char (10) */
    /* Scale down slightly if needed, or keep big? User just said move position. */
    /* Let's keep size for now but align right */
    align-items: top;
    /* Keep text centered internally */
}

/* ==================== GLOBAL TOP BAR ==================== */
#global-top-bar {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    pointer-events: none;

    /* Background Frame */
    width: calc(100% - 40px);
    height: 60px;
    background: url('./assets/slots/common/long_frame.png') no-repeat center center;
    background-size: 100% 100%;
    padding: 0 0px;
}

.resource-item {
    position: relative;
    width: 115px;
    /* 144 * 0.8 */
    height: 32px;
    /* 40 * 0.8 */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Icon on left, Text next */
    pointer-events: auto;
    /* Allow interaction if we add tooltips later */
}

.resource-frame {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(-50%);
    background: url('./assets/slots/common/long_text_frame.png') no-repeat center center;
    background-size: 100% 100%;
    z-index: 1;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.5));
}

.resource-icon {
    position: relative;
    z-index: 2;
    width: 32px;
    /* 40 * 0.8 */
    height: 38px;
    /* 48 * 0.8 */
    margin-left: -6px;
    /* -8 * 0.8 */
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.resource-text {
    position: relative;
    z-index: 2;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    /* 16 * 0.8 */
    font-weight: 700;
    color: #ffd700;
    /* Gold color */
    margin-left: 6px;
    /* 8 * 0.8 */
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.8);
    flex-grow: 1;
    text-align: center;
    /* Center text in remaining space */
    padding-right: 6px;
    /* 8 * 0.8 */
}

/* ==================== DICE PAGE STYLES ==================== */

/* Dice Bonus Icon (Similar to Stage/Wheel Icon) */
#dice-bonus-icon {
    position: relative;
    top: auto;
    right: auto;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 150;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

#dice-bonus-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#dice-bonus-icon:hover {
    transform: scale(1.15);
    animation: diceShake 0.5s ease-in-out;
}

@keyframes diceShake {

    0%,
    100% {
        transform: scale(1.15) rotate(0deg);
    }

    25% {
        transform: scale(1.15) rotate(-15deg);
    }

    75% {
        transform: scale(1.15) rotate(15deg);
    }
}

/* Dice Page Background */
.dice-bg-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
            #1a0a2e 0%,
            #2d1b4e 25%,
            #4a2c5a 50%,
            #1a1a40 75%,
            #0a0a1a 100%);
    z-index: 0;
}

/* Dice Page Back Button */
.back-btn-dice {
    position: fixed;
    top: 10px;
    left: 30px;
    padding: 0;
    width: 160px;
    height: 160px;
    background: url('./assets/buttons/btn_back.png') no-repeat center center;
    background-size: contain;
    border: none;
    border-radius: 0;
    color: #ffffff;
    font-size: 19.6px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: none;
    transition: transform 0.2s ease, filter 0.2s;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.4));
}

.back-btn-dice span {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.back-btn-dice:hover {
    background: url('./assets/buttons/btn_back.png') no-repeat center center;
    background-size: contain;
    border: none;
    transform: scale(1.1);
    box-shadow: none;
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

/* Dice Game Container */
.dice-game-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    z-index: 10;
}

/* Dice Title */
.dice-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(24px, 4vw, 48px);
    /* Responsive: min 24px, max 48px, scales with viewport */
    font-weight: 900;
    color: #FFD700;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.8);
    letter-spacing: clamp(2px, 0.5vw, 4px);
    /* Responsive letter-spacing */
    position: relative;
    top: -150px;
}

/* Dice Area */
/* Dice Area */
.dice-area {
    display: flex;
    gap: 60px;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    /* Enable 3D space */
}

/* 3D Dice Cube */
.dice-cube {
    width: 120px;
    height: 120px;
    position: relative;
    transform-style: preserve-3d;
    /* Key for 3D children */
    transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.3, 1);
    /* Smooth landing */
    /* Remove background from container, faces have it */
}

/* Common Face Style */
.dice-face {
    position: absolute;
    width: 121px;
    /* Overlap by 1px to seal seams */
    height: 121px;
    left: -0.5px;
    top: -0.5px;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 50%, #dcdcdc 100%);
    border: 1px solid #ccc;
    /* crisper border */
    border-radius: 8px;
    /* Reduced from 20px to reduce gaps at corners */
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.03);
    /* Softer inner shadow */
    backface-visibility: hidden;
    padding: 10px;
    box-sizing: border-box;
}

/* Dots */
.dot {
    display: block;
    width: 24px;
    height: 24px;
    background: #2a2a2a;
    border-radius: 50%;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Face Layouts - Standard Dice Positions */
.face-1 {
    display: flex;
    justify-content: center;
    align-items: center;
}

.face-2 {
    display: flex;
    justify-content: space-between;
    padding: 20px;
}

.face-2 .dot:nth-child(2) {
    align-self: flex-end;
}

.face-3 {
    display: flex;
    justify-content: space-between;
    padding: 20px;
}

.face-3 .dot:nth-child(2) {
    align-self: center;
}

.face-3 .dot:nth-child(3) {
    align-self: flex-end;
}

.face-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    padding: 22px;
    justify-items: center;
    align-items: center;
}

.face-5 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    padding: 18px;
    justify-items: center;
    align-items: center;
}

/* 5-dot Quincunx Pattern */
/* Row 1: Dot . Dot */
/* Row 2:  .  Dot  . */
/* Row 3: Dot . Dot */
.face-5 .dot:nth-child(1) {
    grid-area: 1 / 1;
}

.face-5 .dot:nth-child(2) {
    grid-area: 1 / 3;
}

.face-5 .dot:nth-child(3) {
    grid-area: 2 / 2;
}

.face-5 .dot:nth-child(4) {
    grid-area: 3 / 1;
}

.face-5 .dot:nth-child(5) {
    grid-area: 3 / 3;
}

.face-6 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
    padding: 18px;
    justify-items: center;
    align-items: center;
    /* Default flow fills row 1 (left, right), row 2 (left, right)... which looks like 2 cols of 3 */
}

/* 3D Face Positioning (120px size -> translateZ 60px) */
/* Front */
.face-1 {
    transform: rotateY(0deg) translateZ(60px);
}

/* Back */
.face-6 {
    transform: rotateY(180deg) translateZ(60px);
}

/* Right */
.face-4 {
    transform: rotateY(90deg) translateZ(60px);
}

/* Left */
.face-3 {
    transform: rotateY(-90deg) translateZ(60px);
}

/* Top */
.face-2 {
    transform: rotateX(90deg) translateZ(60px);
}

/* Bottom */
.face-5 {
    transform: rotateX(-90deg) translateZ(60px);
}

/* Rolling Animation - Vertical Scroll Style */
.dice-cube.rolling {
    animation: diceScrollSpin 0.6s linear infinite;
}

@keyframes diceScrollSpin {
    0% {
        transform: rotateX(0deg) rotateY(10deg);
    }

    100% {
        transform: rotateX(360deg) rotateY(10deg);
    }
}

/* Landed Effect (Optional bounce) */
.dice-cube.landed {
    /* Animation handled by specific transition in JS, but we can add a pulse */
    animation: none;
}

/* Roll Button */
.dice-roll-btn {
    position: relative;
    top: 50px;
    padding: 20px 60px;
    background: linear-gradient(180deg, #FF6B00 0%, #FF4500 50%, #CC3700 100%);
    border: 4px solid #FFD700;
    border-radius: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    box-shadow:
        0 8px 25px rgba(255, 100, 0, 0.5),
        inset 0 2px 3px rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.dice-roll-btn .roll-text {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    letter-spacing: 3px;
}

.dice-roll-btn .roll-cost {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 5px;
}

.dice-roll-btn .roll-cost .energy-icon {
    width: 20px;
    height: 20px;
}

.dice-roll-btn:hover:not(:disabled) {
    transform: translateY(-5px) scale(1.05);
    box-shadow:
        0 15px 35px rgba(255, 100, 0, 0.7),
        inset 0 2px 3px rgba(255, 255, 255, 0.4);
}

.dice-roll-btn:active:not(:disabled) {
    transform: translateY(2px) scale(0.98);
}

.dice-roll-btn:disabled {
    filter: grayscale(0.7) brightness(0.7);
    cursor: not-allowed;
}

/* Dice Result Popup */
.dice-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dice-popup.visible {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.dice-popup.hidden {
    opacity: 0;
    visibility: hidden;
}

#level-up-popup {
    z-index: 1700;
    background: var(--menu-overlay-bg, rgba(0, 0, 0, 0.85));
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#level-up-popup .dice-popup-content {
    width: 70%;
    max-width: 320px;
    min-width: 240px;
    min-height: 500px;
    position: relative;
    text-align: center;
    background:
        radial-gradient(120% 100% at 15% 0%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.02) 38%, rgba(255, 255, 255, 0) 70%),
        linear-gradient(180deg, rgba(92, 64, 128, 0.72) 0%, rgba(69, 41, 110, 0.74) 48%, rgba(50, 25, 86, 0.78) 100%);
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 24px;
    padding: 36px 28px 28px;
    gap: 16px;
    backdrop-filter: blur(16px) saturate(130%);
    -webkit-backdrop-filter: blur(16px) saturate(130%);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.58),
        0 0 0 1px rgba(255, 255, 255, 0.14) inset,
        0 0 0 2px rgba(255, 214, 110, 0.12);
}

#level-up-popup .dice-popup-content::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

#level-up-popup .dice-popup-content::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 16px;
    right: 16px;
    height: 84px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.02));
    pointer-events: none;
}

#level-up-popup .popup-title {
    color: #ffd66e;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    margin-bottom: 6px;
}

#level-up-popup .popup-dice-result {
    width: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 22px;
    gap: 10px;
}

#level-up-popup .popup-dice-result .dice-symbol:first-child {
    font-size: 28px;
}

#level-up-popup #level-up-range {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
}

#level-up-popup .popup-reward-dice {
    width: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
    border-radius: 16px;
    padding: 13px 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#level-up-popup .popup-reward-dice .reward-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#level-up-popup .popup-reward-dice .coin-icon {
    width: 52px;
    height: 52px;
}

#level-up-popup .popup-reward-dice .reward-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #ffffff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

#level-up-popup .reward-label {
    color: #dcd2f1;
    text-align: center;
    margin: 6px 0 14px;
}

#level-up-popup .popup-close-btn {
    width: 100%;
    height: 66px;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffd700 0%, #ffaa00 100%);
    color: #3e1f00;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    box-shadow: 0 6px 0 #b37400, 0 12px 20px rgba(0, 0, 0, 0.38);
    margin-top: auto;
}

#level-up-popup .popup-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #b37400, 0 15px 25px rgba(0, 0, 0, 0.42);
}

#level-up-popup .popup-close-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b37400, 0 4px 10px rgba(0, 0, 0, 0.35);
}

.dice-popup-content {
    background: linear-gradient(180deg, #2d1b4e 0%, #1a0a2e 100%);
    border: 4px solid #FFD700;
    border-radius: 30px;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow:
        0 0 50px rgba(255, 215, 0, 0.3),
        inset 0 0 20px rgba(255, 215, 0, 0.1);
    animation: popupBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.dice-popup-content .popup-title {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 3px 10px rgba(255, 215, 0, 0.5);
    margin: 0;
}

/* Dice Result Display */
.popup-dice-result {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: 'Outfit', sans-serif;
    font-size: 48px;
    color: #fff;
}

.result-dice {
    font-size: 64px;
    color: #FFD700;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
}

.result-plus,
.result-equals {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.6);
}

.result-total {
    font-size: 56px;
    font-weight: 900;
    color: #FF6B00;
    text-shadow: 0 3px 10px rgba(255, 100, 0, 0.5);
}

/* Popup Reward */
.popup-reward-dice {
    display: flex;
    align-items: center;
    gap: 10px;
}

.popup-reward-dice .coin-icon {
    width: 40px;
    height: 40px;
}

.popup-reward-dice .reward-value {
    font-family: 'Outfit', sans-serif;
    font-size: 42px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
}

.dice-popup-content .reward-label {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Popup Close Button */
.dice-popup-content .popup-close-btn {
    padding: 15px 50px;
    background: linear-gradient(180deg, #FFD700 0%, #FF8C00 100%);
    border: none;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #1a0a2e;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
}

.dice-popup-content .popup-close-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6);
}

/* ==================== STAGE POINT PAGE STYLES ==================== */

/* Stage Point Icon in Sidebar */
#stage-point-icon-wrapper #stage-point-icon {
    position: relative;
    top: auto;
    right: auto;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 150;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

#stage-point-icon-wrapper #stage-point-icon img {
    width: 55px;
    height: 55px;
    object-fit: contain;
}

#stage-point-icon-wrapper #stage-point-icon:hover {
    transform: scale(1.15);
}

/* Page Layout */
/* Page Layout */
.stage-point-layout {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    /* Grid Variables with Defaults */
    --grid-top-h: 20vh;
    --grid-bottom-h: 25vh;

    grid-template-rows: var(--grid-top-h) 1fr var(--grid-bottom-h);
    /* Single centered column */
    grid-template-columns: 1fr;
    grid-template-areas:
        "top-center"
        "mid-center"
        ".";

    z-index: 1500;
    pointer-events: none;
    box-sizing: border-box;
}

/* Grid Items Positioning */
/* Grid Items Positioning */
#stage-point-back-btn {
    grid-area: top-left;
    align-self: center;
    justify-self: center;
    pointer-events: auto !important;
    background: linear-gradient(180deg, #445 0%, #223 100%);
    border: 1px solid #667;
    color: #ddd;
    padding: 6px 16px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;

    /* Strict Positioning Override */
    position: relative !important;
    z-index: 9999;
    top: auto !important;
    left: auto !important;
    margin: auto;
}

#stage-point-layout-btn {
    grid-area: top-right;
    align-self: center;
    justify-self: center;
    pointer-events: auto !important;

    /* Strict Positioning Override */
    position: relative !important;
    z-index: 9999;
    top: auto !important;
    right: auto !important;
    margin: auto;
}

#stage-point-back-btn:hover {
    background: linear-gradient(180deg, #556 0%, #334 100%);
    color: #fff;
    transform: translateX(-2px);
}

/* 2. Point Area */
/* 2. Point Area */
.stage-point-display-area {
    grid-area: top-center;
    width: min(540px, calc(100% - 70px));
    max-width: 540px;
    min-width: 280px;
    margin: 0 auto;
    /* Center when hitting max-width */
    height: 90%;
    align-self: center;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 0 6px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.point-rate-box,
.point-total-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    /* Glassmorphism style matching main page */
    background: rgba(225, 225, 241, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.06);
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.6),
        inset 0 0 10px rgba(255, 215, 0, 0.05);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Animated glow effect */
.point-rate-box::before,
.point-total-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, transparent 70%);
    animation: pointGlassGlow 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pointGlassGlow {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate(10%, 10%) scale(1.1);
        opacity: 0.6;
    }
}

.point-rate-box:hover,
.point-total-box:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 215, 0, 0.15);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.7),
        inset 0 0 15px rgba(255, 215, 0, 0.1);
}

.point-label {
    color: #FFD700;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(255, 215, 0, 0.5);
    position: relative;
    z-index: 1;
}

.point-value-row {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.point-icon-small {
    width: 40px;
    height: auto;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    }

    50% {
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.9));
    }
}

#stage-point-total,
#stage-point-rate {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #FFFFFF;
    background: linear-gradient(180deg, #FFFFFF 0%, #E0E0E0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.7));
    position: relative;
    z-index: 1;
}

/* 3. Stage Card Area */
.stage-point-card-area {
    grid-area: mid-center;
    width: 100%;
    max-width: 600px;
    min-width: 320px;
    margin: 0 auto;
    height: 100%;
    /* Background image with glassmorphism overlay */
    background-image: url('./assets/slots/common/stage_card_area_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgba(255, 215, 0, 0.08);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 400px;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.6),
        inset 0 0 10px rgba(255, 215, 0, 0.05);
    position: relative;
}

/* Glassmorphism overlay for card area */
.stage-point-card-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 26, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 20px;
    pointer-events: none;
    z-index: 0;
}

.card-area-header {
    flex: 0 0 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    /* Glassmorphism header */
    background: rgba(225, 225, 241, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    z-index: 1;
    color: #fff4bf;
    font-size: 24px;
    font-weight: 900;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow:
        0 3px 12px rgba(0, 0, 0, 0.92),
        0 0 28px rgba(255, 215, 0, 0.65),
        0 0 4px rgba(255, 244, 191, 0.9);
    position: relative;
    overflow: hidden;
}

/* Animated shine effect for header */
.card-area-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    animation: headerShine 3s ease-in-out infinite;
}

@keyframes headerShine {
    0% {
        left: -100%;
    }

    100% {
        left: 200%;
    }
}

.stage-card-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: auto;
    /* Subtle inner shadow */
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Scrollbar Styling */
.stage-card-list-scroll::-webkit-scrollbar {
    width: 8px;
}

.stage-card-list-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.stage-card-list-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
            rgba(138, 43, 226, 0.6) 0%,
            rgba(75, 0, 130, 0.8) 100%);
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.stage-card-list-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg,
            rgba(138, 43, 226, 0.8) 0%,
            rgba(75, 0, 130, 1) 100%);
    border-color: rgba(255, 215, 0, 0.4);
}

/* Stage Wrapper - Contains title header + cards */
.stage-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

/* Theme Header Area */
.stage-theme-header {
    display: flex;
    align-items: center;
    padding: 0;
    position: relative;
}

/* Card Items */
.stage-point-card {
    height: var(--card-height, 280px);
    /* Universal glassmorphism - no theme variations */
    background: rgba(225, 225, 241, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.08);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #eee;
    font-size: 18px;
    font-weight: 600;
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.6),
        inset 0 0 10px rgba(255, 215, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* Subtle glow effect */
.stage-point-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, transparent 70%);
    animation: cardGlassGlow 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cardGlassGlow {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: translate(10%, 10%) scale(1.1);
        opacity: 0.6;
    }
}

.stage-point-card:hover {
    transform: translateY(-4px) scale(1.01);
    background: rgba(225, 225, 241, 0.1);
    border-color: rgba(255, 215, 0, 0.15);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.7),
        inset 0 0 15px rgba(255, 215, 0, 0.1);
}

/* Specific Style for Card 1 - Background image removed */
.stage-point-card:first-child {
    /* Background image removed - using gradient from theme variables */
    position: relative;
}

/* Theme Name Display */
.stage-theme-name {
    position: relative;
    display: inline-block;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    text-shadow:
        0 2px 9px rgba(0, 0, 0, 0.9),
        0 0 22px var(--theme-glow-color, rgba(255, 215, 0, 0.8)),
        0 1px 2px rgba(0, 0, 0, 1),
        0 0 45px var(--theme-glow-color, rgba(255, 215, 0, 0.4));
    padding: 9px 18px;
    /* Glassmorphism style */
    background: rgba(225, 225, 241, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--theme-border-color, rgba(255, 215, 0, 0.3));
    letter-spacing: 0.75px;
    transition: all 0.3s ease;
    box-shadow:
        0 0 22px var(--theme-glow-color, rgba(255, 215, 0, 0.4)),
        0 4px 15px rgba(0, 0, 0, 0.6),
        inset 0 0 10px rgba(255, 215, 0, 0.05);
    overflow: hidden;
}

/* Decorative corner accents */
.stage-theme-name::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg,
            transparent 0%,
            transparent 50%,
            var(--theme-glow-color, rgba(255, 215, 0, 0.2)) 50%,
            transparent 51%);
    pointer-events: none;
}

.stage-theme-name:hover {
    transform: scale(1.06) translateY(-2px);
    border-color: var(--theme-border-color, rgba(255, 215, 0, 0.9));
    box-shadow:
        0 0 30px var(--theme-glow-color, rgba(255, 215, 0, 0.7)),
        0 6px 18px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow:
        0 2px 9px rgba(0, 0, 0, 0.9),
        0 0 30px var(--theme-glow-color, rgba(255, 215, 0, 1)),
        0 1px 2px rgba(0, 0, 0, 1),
        0 0 60px var(--theme-glow-color, rgba(255, 215, 0, 0.6));
}

/* Images inside card */
/* Station Item (Internal Card) */
/* Station Item (Internal Card) */
.stage-card-item {
    position: relative;
    width: 30%;
    height: 94%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    margin: 0 1%;
    padding-top: 10%;
    padding-bottom: 2%;
    box-sizing: border-box;
    gap: 0;
    /* Enhanced glassmorphism effect */
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    /* Ensure card container is positioned */
    z-index: 1;
}

.item-state-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 12;
    min-width: 46px;
    height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.item-state-badge.is-normal {
    color: #e8ffe8;
    background: linear-gradient(180deg, #3ecf75 0%, #1e9f4e 100%);
    border: 1px solid rgba(180, 255, 210, 0.65);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.28);
}

.item-state-badge.is-damaged {
    color: #fff5f5;
    background: linear-gradient(180deg, #ff6b6b 0%, #c62828 100%);
    border: 1px solid rgba(255, 192, 192, 0.75);
    box-shadow: 0 0 14px rgba(255, 82, 82, 0.34);
}

.stage-card-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--theme-border-color, rgba(255, 215, 0, 0.4));
    transform: translateY(-6px);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.4),
        0 0 20px var(--theme-glow-color, rgba(255, 215, 0, 0.3)),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.stage-card-item.is-damaged {
    border-color: rgba(255, 120, 120, 0.5);
    background: rgba(60, 24, 24, 0.28);
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.36),
        inset 0 0 24px rgba(255, 88, 88, 0.14);
    animation: damagedCardShake 2.8s ease-in-out infinite;
}

.stage-card-item.is-damaged::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 11;
    pointer-events: none;
    border-radius: 16px;
    background:
        repeating-linear-gradient(12deg,
            rgba(255, 255, 255, 0.08) 0px,
            rgba(255, 255, 255, 0.08) 1px,
            transparent 1px,
            transparent 8px),
        radial-gradient(circle at 80% 24%, rgba(255, 115, 115, 0.22) 0%, transparent 38%);
    mix-blend-mode: screen;
    opacity: 0.55;
    animation: damagedOverlayFlicker 1.8s steps(2, end) infinite;
}

.stage-card-item.is-damaged .item-profile {
    filter: grayscale(0.55) brightness(0.9) contrast(1.08);
    border-color: rgba(255, 160, 160, 0.38);
    box-shadow:
        0 0 10px rgba(255, 120, 120, 0.2),
        0 0 20px rgba(255, 120, 120, 0.14),
        0 6px 16px rgba(0, 0, 0, 0.35);
    animation: damagedProfileGlitch 1.4s steps(2, end) infinite;
}

.stage-card-item.is-damaged .item-btn-box {
    filter: hue-rotate(-20deg) saturate(0.8);
}

.stage-card-item.is-damaged .btn-text {
    color: #ffb4b4;
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.9),
        0 0 14px rgba(255, 108, 108, 0.45);
}

@keyframes damagedCardShake {

    0%,
    86%,
    100% {
        transform: translate(0, 0);
    }

    88% {
        transform: translate(-1px, 0);
    }

    90% {
        transform: translate(1px, 0);
    }

    92% {
        transform: translate(-1px, 0);
    }

    94% {
        transform: translate(1px, 0);
    }
}

@keyframes damagedOverlayFlicker {

    0%,
    50%,
    100% {
        opacity: 0.55;
    }

    10% {
        opacity: 0.28;
    }

    60% {
        opacity: 0.7;
    }
}

@keyframes damagedProfileGlitch {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-1px);
    }

    40% {
        transform: translateX(1px);
    }

    60% {
        transform: translateX(-1px);
    }

    80% {
        transform: translateX(1px);
    }
}

.item-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}


/* 1. Profile Container */
.item-profile-container {
    /* Size */
    width: var(--card-profile-width, 55%);
    height: var(--card-profile-height, auto);
    /* Position (Margins) */
    margin-top: var(--card-profile-top, 0%);
    margin-bottom: var(--card-profile-bottom, 2%);

    /* Flex Behavior */
    flex-shrink: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.item-profile-container::before {
    content: '';
    position: absolute;
    inset: -4%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 248, 220, 0.35) 45%, rgba(255, 215, 0, 0.08) 75%, rgba(0, 0, 0, 0.08) 100%);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.15),
        inset 0 0 18px rgba(255, 255, 255, 0.5);
    pointer-events: none;
    z-index: 1;
}

/* Mining effect: circulating stars around profile circle */
.stage-card-item.is-mining .item-profile-container::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff6cc 0%, #ffe08a 55%, rgba(255, 224, 138, 0) 70%);
    box-shadow:
        0 0 10px rgba(255, 244, 196, 0.95),
        0 0 22px rgba(255, 224, 138, 0.75),
        0 0 36px rgba(255, 224, 138, 0.45);
    pointer-events: none;
    transform: translate(-50%, -50%) rotate(0deg) translateX(55px);
    transform-origin: center;
    animation: miningStarOrbit 6s linear infinite;
    z-index: 4;
}

@keyframes miningStarOrbit {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) translateX(55px);
        opacity: 0.95;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg) translateX(55px);
        opacity: 0.95;
    }
}

.item-profile {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 50%;
    object-fit: contain;
    position: relative;
    z-index: 3;
    /* Softer, premium glow */
    filter: brightness(1.05) contrast(1.02);
    box-shadow:
        0 0 10px rgba(255, 215, 0, 0.25),
        0 0 22px rgba(255, 215, 0, 0.18),
        0 6px 16px rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 215, 0, 0.25);
    transition: all 0.3s ease;
    animation: profileGlow 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

.item-profile:hover {
    box-shadow:
        0 0 16px rgba(255, 215, 0, 0.35),
        0 0 30px rgba(255, 215, 0, 0.25),
        0 10px 24px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 215, 0, 0.4);
    transform: scale(1.05);
    filter: brightness(1.1) contrast(1.05);
}

@keyframes profileGlow {

    0%,
    100% {
        box-shadow:
            0 0 10px rgba(255, 215, 0, 0.25),
            0 0 22px rgba(255, 215, 0, 0.18),
            0 4px 14px rgba(0, 0, 0, 0.35);
    }

    50% {
        box-shadow:
            0 0 16px rgba(255, 215, 0, 0.35),
            0 0 30px rgba(255, 215, 0, 0.25),
            0 6px 16px rgba(0, 0, 0, 0.4);
    }
}

/* 2. Stars (Grade) */
.item-stars {
    /* Size */
    width: var(--card-stars-width, auto);
    height: var(--card-stars-height, auto);
    /* Position */
    margin-top: var(--card-stars-top, 0%);
    margin-bottom: var(--card-stars-bottom, 2%);

    flex: 0 0 auto;
    z-index: 10;
    display: flex;
    gap: 2px;
    justify-content: center;
    position: relative;
}

.item-stars img {
    width: 16px;
    height: auto;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 1)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)) brightness(1.2);
    transition: all 0.3s ease;
}

.item-stars img:hover {
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 1)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7)) brightness(1.3);
    transform: scale(1.25) rotate(18deg);
}

/* 3. Rate Box (Time) */
.item-rate-box {
    /* Size */
    width: var(--card-rate-width, 85%);
    flex: 0 0 var(--card-rate-height, 14%);
    /* Position */
    margin-top: var(--card-rate-top, 0%);
    margin-bottom: var(--card-rate-bottom, 0%);

    z-index: 10;
    /* Background image removed */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--lp-icon-size, 36px);
    position: relative;
}

.rate-text {
    font-size: 11px;
    color: #FFD700;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    text-shadow:
        0 1px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 215, 0, 0.4);
    line-height: 1;
    height: var(--lp-icon-size, 36px);
    display: inline-flex;
    align-items: center;
    align-self: center;
    transform: translateY(-1px);
}

/* LP Icon before rate text */
.lp-icon {
    width: var(--lp-icon-size, 36px);
    height: var(--lp-icon-size, 36px);
    object-fit: contain;
    display: block;
    align-self: center;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.7));
}

/* 4. Status Box (Button) */
.item-btn-box {
    /* Size */
    width: var(--card-btn-width, 85%);
    flex: 0 0 var(--card-btn-height, 16%);
    /* Position */
    margin-top: var(--card-btn-top, 0%);
    margin-bottom: var(--card-btn-bottom, 0%);

    z-index: 10;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}


/* Premium button overlay */
.item-btn-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
            rgba(255, 215, 0, 0.2) 0%,
            rgba(255, 165, 0, 0.1) 50%,
            transparent 100%);
    pointer-events: none;
}

.item-btn-box:hover {
    transform: scale(1.05);
    filter: brightness(1.2) drop-shadow(0 4px 12px rgba(255, 215, 0, 0.4));
}

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

.btn-text {
    font-size: 12px;
    color: #FFD700;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.9),
        0 0 15px rgba(255, 215, 0, 0.6);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

/* Coin icon in button */
.btn-coin-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
}

.item-btn-box:hover .btn-text {
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.9),
        0 0 12px rgba(255, 215, 0, 0.8);
    transform: scale(1.05);
}


/* 5. Cost Box (New) */
.item-cost-box {
    /* Size */
    width: var(--card-cost-width, 85%);
    flex: 0 0 var(--card-cost-height, 12%);
    /* Position */
    margin-top: var(--card-cost-top, 2%);
    margin-bottom: var(--card-cost-bottom, 0%);

    z-index: 1;
    background-image: url('./assets/slots/theme_00/stage_card_list02.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.cost-text {
    font-size: 12px;
    color: #FFD700;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.9),
        0 0 15px rgba(255, 215, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.upgrade-confetti-piece {
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    opacity: 1;
    animation: confetti-burst 2200ms ease-out forwards;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 5;
    will-change: transform, opacity;
}

@keyframes confetti-burst {
    0% {
        transform: translate(-50%, -50%) scale(var(--sx, 1)) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(var(--sy, 0.8)) rotate(var(--r));
        opacity: 0;
    }
}



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

/* (Removed stray duplicated styles below) */

/* Layout Button */
.layout-btn-simple {
    position: absolute;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #aaa;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.layout-btn-simple:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Layout Settings Panel */
.layout-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #5a4b6e;
    border-radius: 20px;
    padding: 30px;
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    color: #fff;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    pointer-events: auto;
}

/* Stage Point layout panel: keep fully in viewport and scroll internally on small screens */
#stage-point-layout-panel {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    z-index: 3200;
}

.layout-panel * {
    pointer-events: auto;
}

.layout-panel.hidden {
    display: none;
}

.layout-panel h3 {
    margin: 0;
    text-align: center;
    color: #FFD700;
    font-size: 20px;
}

.layout-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layout-control label {
    font-size: 14px;
    color: #ccc;
    display: flex;
    justify-content: space-between;
}

.layout-control input[type="range"] {
    width: 100%;
    cursor: pointer;
}

#close-layout-panel {
    background: #FF6B00;
    border: none;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

#close-layout-panel:hover {
    background: #e65c00;
}

/* ==================== POPUP MODE UTILITY ==================== */
body.popup-active .sidebar,
body.popup-active #sound-toggle-btn,
body.popup-active #body-toggle-btn,
body.popup-active #card-reveal-btn,
body.popup-active #lucky-icon,
body.popup-active #wheel-bonus-icon,
body.popup-active .wheel-info-bar,
body.popup-active .back-btn-wheel,
body.popup-active #global-top-bar,
body.popup-active #mailbox-icon,
body.popup-active #menu-icon,
body.popup-active #top-right-icons,
body.popup-active #bottom-bar,
body.popup-active #open-layout-panel,
body.popup-active .controls-container,
body.popup-active #spin-btn {
    display: none !important;
}


/* Stage Point Side Areas - Now positioned absolutely outside grid */
.stage-side-area {
    position: absolute;
    top: 80px;
    /* Below global top bar (10px + 60px + margin) */
    bottom: 0;
    width: 10%;
    z-index: 100 !important;
    /* Above stage-point-layout */
    pointer-events: none;

    /* Flex layout for button positioning */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
    gap: 20px;
}

.stage-side-area.left {
    left: 1%;
    /* Match top bar margin */
    background: rgba(0, 0, 0, 0.15);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.stage-side-area.right {
    right: 1%;
    /* Match top bar margin */
    background: rgba(0, 0, 0, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

/* Reset Button Styles for Sidebar Context */
#stage-point-back-btn,
#stage-point-layout-btn {
    /* Previously grid-positioned, now flex items */
    position: relative !important;
    grid-area: auto !important;
    justify-self: auto !important;
    align-self: auto !important;
    top: auto !important;
    left: auto !important;
    margin: 0 !important;
    pointer-events: auto !important;
    z-index: 200;
}

/* Top-right icon group */
#top-right-icons {
    position: fixed;
    top: 7px;
    right: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 2000;
}

/* Mailbox/Menu Icons (Top Right) */
#mailbox-icon,
#menu-icon {
    position: relative;
    top: auto;
    right: auto;
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: auto;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

#mailbox-icon {
    width: 35px;
    height: 35px;
}

#menu-icon {
    width: 30px;
    height: 30px;
}

#mailbox-icon img,
#menu-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: translateY(3px);
}

#mailbox-icon:hover,
#menu-icon:hover {
    transform: scale(1.1);
}

/* FX Test Icon (Right Sidebar) */
#fx-test-icon {
    width: 60px;
    height: 60px;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    z-index: 180;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

#fx-test-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#fx-test-icon:hover {
    transform: scale(1.12);
}

/* FX Test Popup */
.fx-test-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 24, 0.82);
    z-index: 2600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.fx-test-container {
    width: min(980px, 94vw);
    max-height: 88vh;
    overflow: auto;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(180deg, rgba(26, 33, 62, 0.95) 0%, rgba(14, 18, 36, 0.96) 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    padding: 16px;
}

.fx-test-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.fx-test-header h2 {
    margin: 0;
    font-size: 20px;
    color: #ffd77a;
}

.fx-test-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    padding: 6px;
}

.fx-test-close-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fx-test-body {
    display: grid;
    grid-template-columns: minmax(260px, 360px) 1fr;
    gap: 16px;
}

.fx-preview-panel {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(11, 16, 33, 0.8);
    padding: 12px;
}

.fx-preview-stage {
    height: 420px;
    border-radius: 12px;
    display: flex;
    align-items: end;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 10%, rgba(255, 211, 117, 0.2), transparent 52%),
        linear-gradient(180deg, rgba(51, 64, 114, 0.45) 0%, rgba(16, 21, 46, 0.8) 100%);
    overflow: hidden;
}

.fx-character-stack {
    position: relative;
    width: 86%;
    height: 94%;
    transform-origin: 50% 90%;
    display: flex;
    align-items: end;
    justify-content: center;
}

#fx-character-body {
    position: relative;
    width: 100%;
    max-height: 100%;
    object-fit: contain;
    z-index: 3;
}

#fx-character-emote {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 58%;
    max-height: 44%;
    object-fit: contain;
    z-index: 2;
    pointer-events: none;
}

.fx-preview-label {
    margin-top: 10px;
    text-align: center;
    font-weight: 700;
    color: #d9e1ff;
}

.fx-control-panel {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(11, 16, 33, 0.8);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fx-row {
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: center;
    gap: 8px;
}

.fx-row label {
    font-size: 13px;
    color: #c9d3ff;
}

.fx-row select {
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    padding: 0 10px;
}

.fx-row.fx-row-slider {
    grid-template-columns: 90px 1fr;
}

.fx-row input[type="range"] {
    width: 100%;
}

#fx-apply-to-game-btn {
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(248, 170, 89, 0.35), rgba(176, 88, 26, 0.5));
    color: #fff4df;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

#fx-apply-to-game-btn:hover {
    filter: brightness(1.08);
}

.fx-presets {
    margin-top: 6px;
    display: grid;
    grid-template-columns: repeat(3, minmax(100px, 1fr));
    gap: 8px;
}

.fx-presets button {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(95, 130, 255, 0.24), rgba(56, 74, 147, 0.4));
    color: #f3f6ff;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    height: 34px;
    cursor: pointer;
    transition: transform 0.16s ease;
}

.fx-presets button:hover {
    transform: translateY(-1px) scale(1.02);
}

.fx-test-log {
    margin: 0;
    min-height: 120px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 8, 20, 0.7);
    color: #b9c8ff;
    padding: 10px;
    font-size: 12px;
    white-space: pre-wrap;
}

.fx-character-stack.fx-anim-pop {
    animation: fxPop 420ms ease-out;
}

.fx-character-stack.fx-anim-shake {
    animation: fxShake 520ms ease-in-out;
}

.fx-character-stack.fx-anim-pulse {
    animation: fxPulse 900ms ease-in-out;
}

@keyframes fxPop {
    0% {
        transform: translateY(0) scale(1);
    }

    45% {
        transform: translateY(-12px) scale(1.08);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes fxShake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-10px);
    }

    40% {
        transform: translateX(10px);
    }

    60% {
        transform: translateX(-8px);
    }

    80% {
        transform: translateX(8px);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes fxPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@media (max-width: 900px) {
    .fx-test-body {
        grid-template-columns: 1fr;
    }

    .fx-preview-stage {
        height: 320px;
    }

    .fx-presets {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 700px) {
    #global-top-bar {
        width: calc(100% - 12px);
        height: 52px;
        gap: 4px;
    }

    .resource-item {
        width: 96px;
        height: 30px;
    }

    .resource-icon {
        width: 26px;
        height: 30px;
        margin-left: -3px;
    }

    .resource-text {
        font-size: 12px;
        margin-left: 2px;
        padding-right: 3px;
    }

    #top-right-icons {
        top: 10px;
        right: 10px;
        gap: 10px;
    }

    #stage-point-page .stage-point-layout {
        top: 96px !important;
        height: calc(100% - 96px) !important;
        padding: 6px 8px 8px !important;
        gap: 8px !important;
        --grid-top-h: 108px !important;
        --grid-bottom-h: 0vh !important;
    }

    #stage-point-page .stage-point-display-area {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        height: 100% !important;
        padding: 0 !important;
        gap: 6px !important;
    }

    #stage-point-page .point-rate-box,
    #stage-point-page .point-total-box {
        border-radius: 12px;
    }

    #stage-point-page .point-label {
        font-size: 11px;
        letter-spacing: 0.5px;
    }

    #stage-point-page .point-value-row {
        gap: 6px;
    }

    #stage-point-page .point-icon-small {
        width: 28px;
    }

    #stage-point-total,
    #stage-point-rate,
    #stage-point-level {
        font-size: 16px !important;
        line-height: 1.05;
    }

    #stage-point-page .stage-point-card-area {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        min-height: 0 !important;
        border-radius: 16px;
    }

    #stage-point-page .card-area-header {
        flex-basis: 52px;
        font-size: 18px;
        letter-spacing: 1px;
    }

    #stage-point-page .stage-card-list-scroll {
        padding: 10px;
        gap: 12px;
    }

    #stage-point-page .stage-point-card {
        height: 248px !important;
        border-radius: 14px;
    }

    #stage-point-page .stage-card-item {
        width: 31%;
        margin: 0 0.6%;
        border-radius: 12px;
    }

    #stage-point-page .item-state-badge {
        top: 5px;
        right: 5px;
        min-width: 40px;
        height: 18px;
        font-size: 9px;
        padding: 0 6px;
    }

    #stage-point-page .stage-side-area {
        top: 60px;
        bottom: auto;
        width: auto;
        padding-top: 0;
        background: transparent;
        border: none;
        z-index: 1805 !important;
    }

    #stage-point-page .stage-side-area.left {
        left: 8px;
    }

    #stage-point-page .stage-side-area.right {
        right: 8px;
    }

    #stage-point-page #stage-point-back-btn,
    #stage-point-page #stage-point-layout-btn {
        width: 58px;
        height: 34px;
        padding: 4px 8px;
        font-size: 11px;
    }

}
