﻿@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&display=swap');
        @import url('https://fonts.googleapis.com/css2?family=DotGothic16&display=swap');
        @import url('https://fonts.googleapis.com/css2?family=Zen+Dots&display=swap');

        /* --- result.html 変数定義 --- */
        :root {
            --crm-primary: #ffcc00;
            --crm-accent: #00f2ff;
            --crm-bg-start: #050510;
            --crm-bg-end: #1a1a3a;
            --crm-text: #ffffff;
            --crm-sub-text: #666666;
            --crm-font-main: 'Zen Dots', sans-serif;
            --crm-font-sub: 'DotGothic16', sans-serif;
            --primary: #00f2ff;
        }

        html.sweet-rush-active,
        body.sweet-rush-active {
            height: 100%;
            overflow: hidden !important;
            overscroll-behavior: none;
        }

        body.sweet-rush-active turbo-frame#footer,
        body.sweet-rush-active turbo-frame#detail_footer,
        body.sweet-rush-active > footer,
        body.sweet-rush-active footer.max-w-3xl,
        body.sweet-rush-active .ui-footer {
            display: none !important;
        }

        #main-body {
            margin: 0;
            padding: 0;
            overflow: hidden;
            background: #1a0520;
            display: block;
            position: relative;
            width: 100%;
            height: var(--sweet-rush-viewport-height, 100vh);
            height: var(--sweet-rush-viewport-height, 100dvh);
            min-height: 0;
            font-family: 'Outfit', sans-serif;
            overscroll-behavior: none;
            touch-action: manipulation;
        }

        #main-body .hidden {
            display: none !important;
        }

        #error-overlay,
        #loading-overlay {
            position: absolute;
            inset: 0;
            z-index: 40000;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(5, 5, 16, 0.72);
            backdrop-filter: blur(6px);
        }

        #loading-overlay .loading-container,
        #error-overlay .error-modal {
            width: min(320px, calc(100% - 48px));
            border-radius: 8px;
            background: linear-gradient(135deg, rgba(26, 10, 46, 0.96), rgba(14, 5, 24, 0.96));
            border: 1px solid rgba(255, 105, 180, 0.32);
            box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
            padding: 24px 20px;
            color: #ffffff;
            text-align: center;
            box-sizing: border-box;
        }

        #loading-overlay .spinner {
            display: flex;
            justify-content: center;
            gap: 6px;
            margin-bottom: 14px;
        }

        #loading-overlay .dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: #ff69b4;
            animation: loadingDotPulse 1s ease-in-out infinite;
        }

        #loading-overlay .dot:nth-child(2n) {
            background: #ffd700;
            animation-delay: 0.12s;
        }

        #loading-overlay .dot:nth-child(3n) {
            background: #76ff03;
            animation-delay: 0.24s;
        }

        @keyframes loadingDotPulse {
            0%, 100% { transform: translateY(0); opacity: 0.45; }
            50% { transform: translateY(-5px); opacity: 1; }
        }

        #error-overlay .error-main {
            margin: 0 0 8px;
            color: #ff69b4;
            font-size: 16px;
            font-weight: 800;
        }

        #error-overlay .error-sub {
            margin: 0 0 16px;
            color: rgba(255, 255, 255, 0.78);
            font-size: 13px;
            line-height: 1.5;
        }

        #error-overlay .modal-button {
            min-width: 112px;
            border: 0;
            border-radius: 8px;
            background: #ff69b4;
            color: #ffffff;
            padding: 10px 16px;
            font-weight: 800;
            cursor: pointer;
        }

        #game-scale-frame {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 375px;
            height: 667px;
            transform: translate(-50%, -50%) scale(var(--sweet-rush-scale, 1));
            transform-origin: center center;
            z-index: 0;
        }

        #game-wrapper {
            position: relative;
            width: 375px;
            height: 667px;
            background: url('https://cdn.torekazi.com/images/game/s11r/背景.jpg') center center / cover no-repeat;
            box-shadow: 0 0 40px rgba(255, 105, 180, 0.3);
            overflow: hidden;
            border-radius: 12px;
            border: 1px solid rgba(255, 105, 180, 0.2);
            transition: box-shadow 0.8s ease, border-color 0.8s ease;
        }

        /* Danger pulse: red vignette flash when last life */
        #game-wrapper.danger-pulse::after {
            content: '';
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 9999;
            border-radius: 12px;
            background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 20, 20, 0.35) 100%);
            animation: dangerFlash 1.2s ease-in-out infinite;
        }
        @keyframes dangerFlash {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 0.8; }
        }

        /* Relief flash: gold vignette that fades out */
        #game-wrapper.danger-relief::after {
            content: '';
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 9999;
            border-radius: 12px;
            background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.6) 100%);
            animation: reliefFlash 0.6s ease-out forwards;
            will-change: opacity;
        }
        @keyframes reliefFlash {
            0% { opacity: 1; }
            100% { opacity: 0; }
        }

        /* Relief screen shake */
        #game-wrapper.relief-shake {
            animation: reliefShake 0.4s ease-out;
        }
        @keyframes reliefShake {
            0% { transform: translate(0, 0); }
            15% { transform: translate(-4px, 2px); }
            30% { transform: translate(4px, -2px); }
            45% { transform: translate(-3px, 1px); }
            60% { transform: translate(2px, -1px); }
            80% { transform: translate(-1px, 0); }
            100% { transform: translate(0, 0); }
        }

        /* Relief candy pop: extra dramatic recovery */
        .life-icon.relief-pop {
            animation: lifeReliefPop 0.7s cubic-bezier(0.22, 1, 0.36, 1) both !important;
        }
        @keyframes lifeReliefPop {
            0% { transform: scale(0) rotate(-45deg); opacity: 0; filter: brightness(2) drop-shadow(0 0 15px rgba(255,215,0,1)); }
            25% { transform: scale(1.8) rotate(10deg); opacity: 1; filter: brightness(2) drop-shadow(0 0 20px rgba(255,215,0,1)); }
            50% { transform: scale(0.85) rotate(-5deg); opacity: 1; filter: brightness(1.4) drop-shadow(0 0 12px rgba(255,215,0,0.8)); }
            70% { transform: scale(1.25) rotate(3deg); opacity: 1; filter: brightness(1.2) drop-shadow(0 0 8px rgba(255,215,0,0.5)); }
            100% { transform: scale(1) rotate(0deg); opacity: 1; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
        }


        /* Firework system */
        #firework-container {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 45%;
            pointer-events: none;
            z-index: 1;
            overflow: hidden;
        }

        .firework-particle {
            position: absolute;
            border-radius: 50%;
            pointer-events: none;
        }

        .firework-dot {
            position: absolute;
            width: 4px;
            height: 4px;
            border-radius: 50%;
            pointer-events: none;
        }

        .firework-sparkle {
            position: absolute;
            width: 2px;
            height: 2px;
            border-radius: 50%;
            pointer-events: none;
            opacity: 0.8;
        }

        canvas {
            display: block;
            width: 100%;
            height: 100%;
        }

        #ui-container {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            box-sizing: border-box;
        }

        .top-bar {
            display: none;
            justify-content: space-between;
            align-items: center;
            pointer-events: auto;
            background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.2) 100%);
            padding: 10px 16px;
            border-bottom: 1px solid rgba(255, 105, 180, 0.15);
        }

        .stat-box {
            display: flex;
            flex-direction: column;
            align-items: center;
            min-width: 80px;
        }


        .stat-label {
            font-size: 9px;
            color: rgba(255, 105, 180, 0.8);
            text-transform: uppercase;
            letter-spacing: 1.5px;
            font-weight: 600;
        }

        .stat-value {
            font-size: 20px;
            font-weight: 800;
            color: #fff;
            text-shadow: 0 0 8px rgba(255, 20, 147, 0.5);
            line-height: 1.1;
        }

        .stat-value.gold {
            color: #ffd700;
            text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
        }

        /* --- Header Info Row: horizontal bar for WIN + remaining --- */
        #header-info-row {
            position: absolute;
            top: 55px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 100;
            pointer-events: none;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 90%;
            max-width: 340px;
        }

        .win-frame {
            position: relative;
            flex: 0 1 auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0;
            min-width: 180px;
            padding: 12px 14px 5px;
            background: linear-gradient(180deg, rgba(80, 10, 60, 0.88) 0%, rgba(40, 5, 50, 0.92) 100%);
            border: 1.5px solid #ff69b4;
            border-radius: 16px;
            box-shadow:
                0 0 8px rgba(255, 20, 147, 0.5),
                0 0 16px rgba(255, 105, 180, 0.2),
                inset 0 0 6px rgba(255, 105, 180, 0.15);
            overflow: visible;
            transition: border-color 0.4s, box-shadow 0.4s;
        }

        .rank-badge {
            display: none;
        }
        .next-rank-badge {
            display: none;
        }




        /* Lives icons */
        #lives-icons {
            display: flex;
            gap: 4px;
            justify-content: center;
            margin-bottom: 2px;
        }
        .life-icon {
            width: 30px;
            height: 30px;
            line-height: 1;
            transition: all 0.3s ease;
            filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
            display: inline-block;
            position: relative;
            object-fit: contain;
        }
        .life-icon.lost {
            opacity: 0.35;
            filter: grayscale(1) brightness(0.7) drop-shadow(0 0 2px rgba(0,0,0,0.3));
            transform: scale(0.9);
        }
        .life-icon.losing {
            animation: lifeLose 0.6s ease-out forwards;
        }
        @keyframes lifeLose {
            0% { transform: scale(1) rotate(0deg); opacity: 1; filter: none; }
            15% { transform: scale(1.3) rotate(-12deg); opacity: 1; filter: brightness(1.5); }
            30% { transform: scale(1.2) rotate(10deg); opacity: 0.9; }
            50% { transform: scale(0.9) rotate(-5deg); opacity: 0.6; filter: brightness(0.8); }
            70% { transform: scale(0.5) rotate(8deg); opacity: 0.3; }
            100% { transform: scale(0.9); opacity: 0.35; filter: grayscale(1) brightness(0.7); }
        }
        .life-icon.recovered {
            animation: lifeRecover 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
        }
        @keyframes lifeRecover {
            0% { transform: scale(0) rotate(-30deg); opacity: 0; }
            40% { transform: scale(1.5) rotate(5deg); opacity: 1; filter: brightness(1.8) drop-shadow(0 0 8px rgba(255,215,0,0.8)); }
            65% { transform: scale(0.9) rotate(-3deg); opacity: 1; }
            80% { transform: scale(1.15) rotate(1deg); opacity: 1; filter: brightness(1.2); }
            100% { transform: scale(1) rotate(0deg); opacity: 1; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
        }
        .life-icon.danger {
            animation: lifeDanger 0.8s ease-in-out infinite;
        }
        @keyframes lifeDanger {
            0%, 100% {
                filter: drop-shadow(0 0 4px rgba(255,50,50,0.4));
                transform: scale(1);
            }
            15% {
                filter: brightness(1.3) drop-shadow(0 0 10px rgba(255,50,50,0.8));
                transform: scale(1.35);
            }
            30% {
                filter: drop-shadow(0 0 6px rgba(255,50,50,0.5));
                transform: scale(1.0);
            }
            45% {
                filter: brightness(1.2) drop-shadow(0 0 8px rgba(255,50,50,0.7));
                transform: scale(1.25);
            }
            60% {
                filter: drop-shadow(0 0 4px rgba(255,50,50,0.4));
                transform: scale(1);
            }
        }


        /* LAST! cut-in */
        .last-cutin {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0) rotate(-5deg);
            z-index: 9999;
            font-family: 'Outfit', sans-serif;
            font-weight: 900;
            font-size: 72px;
            color: #fff;
            letter-spacing: 6px;
            text-shadow:
                0 0 20px rgba(255, 50, 50, 1),
                0 0 40px rgba(255, 50, 50, 0.8),
                0 0 80px rgba(255, 0, 0, 0.5),
                2px 2px 0 #ff0000,
                -2px -2px 0 #cc0000;
            pointer-events: none;
            animation: lastCutinAnim 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        .last-cutin-bg {
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            height: 80px;
            transform: translateY(-50%) scaleX(0);
            background: linear-gradient(90deg,
                transparent 0%,
                rgba(180, 0, 0, 0.7) 20%,
                rgba(220, 0, 0, 0.9) 50%,
                rgba(180, 0, 0, 0.7) 80%,
                transparent 100%);
            z-index: 9998;
            pointer-events: none;
            animation: lastBgAnim 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        @keyframes lastCutinAnim {
            0% { transform: translate(-50%, -50%) scale(3) rotate(-5deg); opacity: 0; }
            20% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; }
            70% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; }
            100% { transform: translate(-50%, -50%) scale(1.5) rotate(0deg); opacity: 0; }
        }
        @keyframes lastBgAnim {
            0% { transform: translateY(-50%) scaleX(0); opacity: 0; }
            15% { transform: translateY(-50%) scaleX(1.1); opacity: 1; }
            70% { transform: translateY(-50%) scaleX(1); opacity: 0.9; }
            100% { transform: translateY(-50%) scaleX(1.2); opacity: 0; }
        }

        .win-frame .stat-value {
            font-size: 26px;
            font-weight: 900;
            color: #ffd700;
            text-shadow: 0 0 8px rgba(255, 215, 0, 0.7), 0 0 14px rgba(255, 20, 147, 0.3);
            line-height: 1;
            z-index: 1;
            position: relative;
            text-align: center;
            width: 100%;
        }

        .bottom-panel {
            margin-top: auto;
            pointer-events: auto;
            background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 100%);
            padding: 12px 12px 8px;
            border-top: 1px solid rgba(255, 105, 180, 0.15);
        }

        .controls-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 0 8px;
        }

        .controls-left {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: -10px;
        }

        .bet-pill {
            display: flex;
            align-items: center;
            gap: 6px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 105, 180, 0.25);
            padding: 8px 14px;
            border-radius: 24px;
        }

        .bet-pill .bet-label {
            font-size: 9px;
            color: rgba(255, 105, 180, 0.7);
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 600;
        }

        .bet-pill .bet-value {
            font-size: 16px;
            font-weight: 700;
            color: #fff;
            min-width: 40px;
            text-align: center;
        }

        .bet-pill button {
            width: 30px;
            height: 30px;
            font-size: 18px;
            font-weight: 700;
            background: rgba(255, 105, 180, 0.3);
            border: 1px solid rgba(255, 105, 180, 0.5);
            color: #fff;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: all 0.15s;
            line-height: 1;
        }

        .bet-pill button:hover {
            background: rgba(255, 105, 180, 0.5);
        }

        .bet-pill button:active {
            transform: scale(0.9);
        }

        #btn-spin {
            position: relative;
            width: 85px;
            height: 85px;
            background: linear-gradient(160deg, #FF6B9D 0%, #E91E8C 45%, #C2185B 100%);
            border: none;
            border-radius: 50%;
            color: #fff;
            font-family: 'Outfit', sans-serif;
            font-size: 13px;
            font-weight: 800;
            letter-spacing: 1.5px;
            cursor: pointer;
            text-align: center;
            line-height: 1;
            transition: transform 0.12s, box-shadow 0.2s;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            box-shadow:
                0 0 0 3px rgba(255, 255, 255, 0.25),
                0 0 0 6px rgba(255, 20, 147, 0.3),
                0 0 24px rgba(255, 20, 147, 0.5),
                0 6px 16px rgba(0, 0, 0, 0.4),
                inset 0 2px 0 rgba(255, 255, 255, 0.3),
                inset 0 -3px 0 rgba(0, 0, 0, 0.15);
            flex-shrink: 0;
            margin-right: 4px;
            margin-top: -30px;
            -webkit-tap-highlight-color: transparent;
            animation: spinBtnPulse 2s ease-in-out infinite;
            overflow: hidden;
        }

        @keyframes spinBtnPulse {

            0%,
            100% {
                box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25), 0 0 0 6px rgba(255, 20, 147, 0.3), 0 0 24px rgba(255, 20, 147, 0.5), 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.15);
            }

            50% {
                box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35), 0 0 0 8px rgba(255, 20, 147, 0.2), 0 0 36px rgba(255, 20, 147, 0.6), 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.15);
            }
        }

        @keyframes spinBtnShine {
            0% {
                left: -100%;
            }

            15% {
                left: 150%;
            }

            100% {
                left: 150%;
            }
        }

        #btn-spin::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 60%;
            height: 100%;
            background: linear-gradient(105deg,
                    transparent 20%,
                    rgba(255, 255, 255, 0.4) 45%,
                    rgba(255, 255, 255, 0.6) 50%,
                    rgba(255, 255, 255, 0.4) 55%,
                    transparent 80%);
            border-radius: 50%;
            animation: spinBtnShine 3s ease-in-out infinite;
            pointer-events: none;
        }

        #btn-spin:disabled::before {
            animation: none;
            display: none;
        }

        #btn-spin .spin-label {
            font-size: 13px;
            font-weight: 800;
            letter-spacing: 1.5px;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        #btn-spin .start-label {
            display: block;
            font-size: 12px;
            line-height: 1.15;
            letter-spacing: 0;
        }

        #btn-spin:hover {
            transform: scale(1.06);
        }

        #btn-spin:active {
            transform: scale(0.94);
            box-shadow:
                0 0 0 3px rgba(255, 255, 255, 0.25),
                0 0 0 6px rgba(255, 20, 147, 0.3),
                0 0 12px rgba(255, 20, 147, 0.4),
                0 2px 6px rgba(0, 0, 0, 0.4),
                inset 0 2px 0 rgba(255, 255, 255, 0.3),
                inset 0 -3px 0 rgba(0, 0, 0, 0.15);
        }

        #btn-spin:disabled {
            background: linear-gradient(160deg, #999 0%, #777 45%, #555 100%);
            opacity: 1;
            cursor: not-allowed;
            box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1), 0 2px 6px rgba(0, 0, 0, 0.3);
            transform: none;
            pointer-events: none;
            animation: none;
        }

        #btn-info {
            width: 30px;
            height: 30px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: rgba(255, 255, 255, 0.5);
            font-size: 13px;
            font-weight: 700;
            border-radius: 50%;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #btn-info:hover {
            background: rgba(255, 255, 255, 0.2);
            color: #fff;
        }

        #btn-sound {
            width: 30px;
            height: 30px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: rgba(255, 255, 255, 0.5);
            font-size: 16px;
            border-radius: 50%;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 0;
            line-height: 1;
        }

        #btn-sound:hover {
            background: rgba(255, 255, 255, 0.2);
            color: #fff;
        }

        #btn-sound.muted {
            color: rgba(255, 80, 80, 0.6);
            border-color: rgba(255, 80, 80, 0.3);
        }

        #free-spin-panel {
            display: none;
            position: absolute;
            right: -5px;
            top: -12px;
            z-index: 110;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            gap: 3px;
            color: #fff;
            padding: 3px 10px;
            border-radius: 12px;
            background: linear-gradient(135deg, #ff1493, #c71585);
            font-weight: 800;
            white-space: nowrap;
            font-size: 11px;
            line-height: 1.2;
            box-shadow: 0 2px 8px rgba(255, 20, 147, 0.6);
            border: 2px solid rgba(255, 255, 255, 0.5);
        }

        #free-spin-panel .fs-label {
            font-size: 9px;
            letter-spacing: 0.5px;
            opacity: 0.9;
        }

        #free-spin-panel .fs-value {
            font-size: 13px;
            font-weight: 900;
            color: #ffd700;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
        }

        @keyframes fsPulse {

            0%,
            100% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.05);
            }
        }

        @keyframes logoFloat {

            0%,
            100% {
                transform: translateY(0);
            }

            50% {
                transform: translateY(-6px);
            }
        }

        /* Energy trail particle (reused for WIN frame version) */
        .energy-trail {
            position: absolute;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: radial-gradient(circle, #FFD700, #FF69B4);
            box-shadow: 0 0 8px 3px rgba(255, 215, 0, 0.6);
            pointer-events: none;
            z-index: 999;
        }

        /* --- Midnight Fever Free Spin Mode --- */
        #main-body.fs-mode {
            background: linear-gradient(135deg, #2b0a3d 0%, #1a0520 100%) !important;
            transition: background 0.8s ease;
        }

        .fs-mode #game-wrapper {
            background: linear-gradient(135deg, #4a0e4e 0%, #2b0a3d 50%, #7c162e 100%) !important;
            box-shadow: 0 0 60px rgba(255, 215, 0, 0.4), inset 0 0 40px rgba(255, 20, 147, 0.3) !important;
            border: 2px solid rgba(255, 215, 0, 0.6) !important;
            animation: fsFramePulse 2s infinite alternate;
        }

        @keyframes fsFramePulse {
            0% {
                border-color: rgba(255, 215, 0, 0.6);
                box-shadow: 0 0 60px rgba(255, 215, 0, 0.4), inset 0 0 40px rgba(255, 20, 147, 0.3);
            }

            100% {
                border-color: rgba(255, 69, 0, 0.8);
                box-shadow: 0 0 80px rgba(255, 69, 0, 0.6), inset 0 0 60px rgba(255, 0, 0, 0.4);
            }
        }

        @keyframes fsCelebPulse {
            0% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.1);
            }

            100% {
                transform: scale(1);
            }
        }

        @keyframes fsCelebBounce {
            0% {
                transform: scale(0.5);
                opacity: 0;
            }

            60% {
                transform: scale(1.1);
                opacity: 1;
            }

            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        @keyframes fsCelebRays {
            0% {
                transform: translate(-50%, -50%) rotate(0deg);
            }

            100% {
                transform: translate(-50%, -50%) rotate(360deg);
            }
        }

        @keyframes fsCelebFlash {

            0%,
            100% {
                opacity: 0.8;
            }

            50% {
                opacity: 0.2;
            }
        }

        /* Darker grid background in FS mode */
        /* Note: Grid background is drawn in PIXI, so we'll handle that in JS. 
           But we can style HTML overlays if any. */
        /* --- Loading Screen --- */
        #loading-screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #1a0520 0%, #2d0a3e 40%, #1a0520 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 99999;
            transition: opacity 0.8s ease, visibility 0.8s ease;
        }

        #loading-screen.hide {
            opacity: 0;
            visibility: hidden;
        }

        .loading-logo {
            width: 280px;
            max-width: 70vw;
            margin-bottom: 30px;
            filter: drop-shadow(0 4px 20px rgba(255, 20, 147, 0.6));
            animation: loadingFloat 2s ease-in-out infinite;
        }

        @keyframes loadingFloat {

            0%,
            100% {
                transform: translateY(0);
            }

            50% {
                transform: translateY(-12px);
            }
        }

        .loading-candy {
            font-size: 48px;
            margin-bottom: 24px;
            animation: loadingSpin 2s linear infinite;
        }

        @keyframes loadingSpin {
            0% {
                transform: rotate(0deg) scale(1);
            }

            25% {
                transform: rotate(90deg) scale(1.1);
            }

            50% {
                transform: rotate(180deg) scale(1);
            }

            75% {
                transform: rotate(270deg) scale(1.1);
            }

            100% {
                transform: rotate(360deg) scale(1);
            }
        }

        .loading-text {
            font-family: 'Outfit', sans-serif;
            font-size: 16px;
            font-weight: 600;
            color: #ff69b4;
            letter-spacing: 2px;
            margin-bottom: 16px;
        }

        .loading-bar-container {
            width: 240px;
            max-width: 60vw;
            height: 8px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            overflow: hidden;
            box-shadow: 0 0 15px rgba(255, 105, 180, 0.2);
        }

        .loading-bar-fill {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, #ff1493, #ff69b4, #ffd700);
            border-radius: 4px;
            transition: width 0.3s ease;
            box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
        }

        .loading-percent {
            font-family: 'Outfit', sans-serif;
            font-size: 13px;
            color: rgba(255, 255, 255, 0.5);
            margin-top: 10px;
        }

        .tap-to-start {
            font-family: 'Outfit', sans-serif;
            font-size: 22px;
            font-weight: 700;
            color: #fff;
            letter-spacing: 3px;
            margin-top: 30px;
            opacity: 0;
            transition: opacity 0.5s ease;
            animation: tapPulse 1.5s ease-in-out infinite;
            text-shadow: 0 0 20px rgba(255, 105, 180, 0.8), 0 0 40px rgba(255, 105, 180, 0.4);
            cursor: pointer;
        }

        .tap-to-start.visible {
            opacity: 1;
        }

        .replay-start-overlay {
            position: absolute;
            inset: 0;
            z-index: 12000;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #000;
            opacity: 0;
            cursor: pointer;
            pointer-events: auto;
            transition: opacity 0.28s ease;
            border-radius: 12px;
        }

        .replay-start-overlay.open {
            opacity: 1;
        }

        .replay-start-overlay.closing {
            opacity: 0;
            pointer-events: none;
        }

        .replay-start-content {
            position: relative;
            width: 100%;
            min-height: 180px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 0 24px;
            box-sizing: border-box;
            font-family: 'Outfit', sans-serif;
        }

        .replay-start-prompt {
            max-width: 100%;
            font-size: 22px;
            line-height: 1.45;
            font-weight: 900;
            color: #fff;
            text-shadow: 0 0 18px rgba(255, 255, 255, 0.45);
            transition: opacity 0.18s ease, transform 0.18s ease;
            animation: replayTapPulse 1.35s ease-in-out infinite;
        }

        .replay-start-prompt.hide {
            opacity: 0;
            transform: translateY(-10px);
            animation: none;
        }

        .replay-start-countdown {
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            transform: translateY(-50%) scale(0.72);
            opacity: 0;
            font-size: 78px;
            line-height: 1;
            font-weight: 900;
            color: #fff;
            letter-spacing: 0;
            text-shadow: 0 0 24px rgba(255, 255, 255, 0.42);
        }

        .replay-start-countdown.visible {
            opacity: 1;
        }

        .replay-start-countdown.pop {
            animation: replayCountdownPop 0.62s cubic-bezier(0.17, 0.84, 0.44, 1);
        }

        @keyframes replayTapPulse {

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

            50% {
                opacity: 0.56;
                transform: scale(0.96);
            }
        }

        @keyframes replayCountdownPop {
            0% {
                opacity: 0;
                transform: translateY(-50%) scale(0.58);
            }

            28% {
                opacity: 1;
                transform: translateY(-50%) scale(1.1);
            }

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

        @keyframes tapPulse {

            0%,
            100% {
                opacity: 1;
                transform: scale(1);
            }

            50% {
                opacity: 0.5;
                transform: scale(0.95);
            }
        }

        .game-tips {
            display: none;
            flex-direction: column;
            gap: 10px;
            margin-top: 24px;
            padding: 0 20px;
            max-width: 320px;
            opacity: 0;
            transition: opacity 0.6s ease 0.2s;
        }
        .game-tips.visible {
            opacity: 1;
        }
        .game-tip {
            display: flex;
            align-items: center;
            gap: 10px;
            font-family: 'Outfit', sans-serif;
            font-size: 13px;
            color: rgba(255,255,255,0.85);
            line-height: 1.4;
        }
        .game-tip-icon {
            font-size: 20px;
            flex-shrink: 0;
        }

        /* ==========================================
           共通: オーバーレイとボックス (New CRM)
           ========================================== */
        .crm-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(8px);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 10000;
            opacity: 0;
            transition: opacity 0.3s;
        }

        .crm-overlay.open {
            display: flex;
            opacity: 1;
        }

        .crm-box {
            background: linear-gradient(135deg, var(--crm-bg-start) 0%, var(--crm-bg-end) 100%);
            border: 2px solid var(--crm-primary);
            box-shadow: 0 0 40px rgba(255, 204, 0, 0.15);
            padding: 15px 10px;
            border-radius: 16px;
            width: 85%;
            max-width: 360px;
            max-height: 95vh;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            transform: scale(0.9);
            transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        .crm-overlay.open .crm-box {
            transform: scale(1);
        }

        .crm-header {
            width: 100%;
            text-align: center;
            margin-bottom: 10px;
        }

        .crm-title {
            font-family: var(--crm-font-sub);
            font-size: 1.4rem;
            color: var(--crm-primary);
            text-shadow: 0 0 10px rgba(255, 204, 0, 0.4);
            letter-spacing: 1px;
        }

        .crm-title-line {
            width: 60px;
            height: 2px;
            background: var(--crm-primary);
            margin: 8px auto 0;
            box-shadow: 0 0 5px var(--crm-primary);
        }

        .crm-card-area {
            margin-bottom: 10px;
            position: relative;
            perspective: 1000px;
        }

        .crm-card-frame {
            width: 150px;
            height: 210px;
            position: relative;
            border-radius: 12px;
        }

        .crm-card-placeholder {
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.4);
            border: 2px dashed var(--crm-primary);
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: var(--crm-primary);
            position: relative;
            z-index: 2;
            overflow: hidden;
            background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.05) 50%, rgba(255, 255, 255, 0.05) 75%, transparent 75%, transparent);
            background-size: 12px 12px;
            box-shadow: 0 0 20px rgba(255, 204, 0, 0.2), inset 0 0 10px rgba(255, 204, 0, 0.1);
        }

        .crm-card-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 10px;
        }

        .crm-card-icon {
            font-size: 3rem;
            font-family: var(--crm-font-main);
            margin-bottom: 10px;
            opacity: 0.8;
        }

        .crm-card-text {
            font-size: 0.8rem;
            letter-spacing: 2px;
            font-family: var(--crm-font-main);
        }

        .crm-card-name {
            font-family: var(--crm-font-sub);
            font-size: 1.1rem;
            color: #fff;
            text-shadow: 0 0 5px var(--crm-primary);
            margin: 5px 0 0 0;
            text-align: center;
            width: 100%;
            letter-spacing: 1px;
        }

        .crm-card-glow {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 160%;
            height: 160%;
            background: radial-gradient(circle, var(--crm-primary) 0%, transparent 60%);
            opacity: 0.4;
            z-index: 1;
            animation: crmRotateGlow 8s infinite linear, crmPulseGlow 3s infinite ease-in-out;
        }

        @keyframes crmRotateGlow {
            0% {
                transform: translate(-50%, -50%) rotate(0deg);
            }

            100% {
                transform: translate(-50%, -50%) rotate(360deg);
            }
        }

        @keyframes crmPulseGlow {

            0%,
            100% {
                opacity: 0.3;
                transform: translate(-50%, -50%) scale(0.9) rotate(var(--rot, 0deg));
            }

            50% {
                opacity: 0.6;
                transform: translate(-50%, -50%) scale(1.1) rotate(var(--rot, 0deg));
            }
        }

        .crm-score-area {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-bottom: 15px;
            margin-top: 5px;
        }

        .crm-label {
            font-size: 0.7rem;
            color: var(--crm-sub-text);
            letter-spacing: 3px;
            font-family: var(--crm-font-main);
            margin-bottom: 2px;
        }

        .crm-value {
            font-size: 1.5rem;
            color: var(--crm-text);
            font-family: var(--crm-font-main);
            line-height: 1;
            text-shadow: 0 0 15px var(--crm-primary);
        }

        .crm-actions {
            width: 100%;
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }

        .crm-btn-primary {
            width: 100%;
            flex: 0 0 100%;
            order: 1;
            padding: 12px;
            font-size: 1.1rem;
            background: var(--crm-primary);
            color: #000;
            border: none;
            font-family: var(--crm-font-sub);
            font-weight: bold;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            border-radius: 8px;
            transition: transform 0.1s, box-shadow 0.1s;
            position: relative;
            overflow: hidden;
        }

        .crm-btn-primary::after {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            transform: rotate(45deg) translate(-100%, 0);
            animation: crmBtnShine 3s infinite;
        }

        @keyframes crmBtnShine {

            0%,
            80% {
                transform: rotate(45deg) translate(-100%, 0);
            }

            100% {
                transform: rotate(45deg) translate(100%, 0);
            }
        }

        .crm-btn-primary:active {
            transform: scale(0.98);
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
        }

        .crm-btn-redemption {
            width: auto;
            flex: 1 1 calc(50% - 4px);
            min-width: 0;
            order: 3;
            padding: 10px;
            font-size: 1.0rem;
            background: rgba(0, 242, 255, 0.15);
            border: 2px solid var(--crm-accent);
            color: var(--crm-accent);
            font-family: var(--crm-font-sub);
            font-weight: bold;
            box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
            cursor: pointer;
            border-radius: 8px;
            transition: 0.2s;
            position: relative;
            overflow: hidden;
        }

        .crm-btn-redemption:hover {
            background: var(--crm-accent);
            color: #000;
            box-shadow: 0 0 20px var(--crm-accent);
        }

        .crm-btn-replay {
            width: auto;
            flex: 1 1 calc(50% - 4px);
            min-width: 0;
            order: 2;
            padding: 10px;
            font-size: 1.0rem;
            background: rgba(255, 105, 180, 0.12);
            border: 2px solid #ff69b4;
            color: #ffb3d9;
            font-family: var(--crm-font-sub);
            font-weight: bold;
            box-shadow: 0 0 10px rgba(255, 105, 180, 0.22);
            cursor: pointer;
            border-radius: 8px;
            transition: 0.2s;
        }

        .crm-btn-replay:hover {
            background: #ff69b4;
            color: #12071c;
            box-shadow: 0 0 18px rgba(255, 105, 180, 0.5);
        }

        .crm-btn-secondary {
            width: 100%;
            order: 4;
            background: transparent;
            border: none;
            color: var(--crm-sub-text);
            font-size: 0.9rem;
            font-family: var(--crm-font-sub);
            text-decoration: underline;
            cursor: pointer;
            padding: 5px;
            opacity: 0.7;
            transition: opacity 0.2s;
            margin-top: 5px;
        }

        .crm-btn-secondary:hover {
            color: var(--crm-text);
            opacity: 1;
        }

        /* ==========================================
           TCコイン獲得画面 (Bonus Overlay)
           ========================================== */
        .bonus-overlay {
            position: absolute;
            inset: 0;
            background: rgba(5, 5, 16, 0.8);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 30000;
            backdrop-filter: blur(4px);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .bonus-overlay.open {
            display: flex;
            opacity: 1;
        }

        .bonus-panel {
            width: 85%;
            max-width: 400px;
            background: linear-gradient(160deg, #fff5c7 0%, #ffe289 40%, #ffc644 100%);
            border-radius: 24px;
            border: 3px solid #ffb100;
            box-shadow: 0 15px 45px rgba(0, 0, 0, 0.35), inset 0 0 25px rgba(255, 255, 255, 0.35);
            padding: 25px;
            text-align: center;
            position: relative;
            font-family: 'Zen Dots', sans-serif;
            color: #a45d00;
            transform: scale(0.95);
        }

        .bonus-panel::before {
            content: '';
            position: absolute;
            inset: 6px;
            border-radius: 18px;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
            pointer-events: none;
        }

        .bonus-title {
            font-size: 1.3rem;
            letter-spacing: 1px;
            margin-bottom: 24px;
            color: #c05c00;
            text-shadow: 0 2px 8px rgba(255, 255, 255, 0.6);
        }

        .bonus-body {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 16px;
            margin-bottom: 24px;
        }

        .bonus-coin {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: radial-gradient(circle at 30% 30%, #fff1b3, #ffbb33 60%, #cc8400 100%);
            border: 3px solid rgba(255, 255, 255, 0.5);
            box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.4), 0 6px 18px rgba(204, 132, 0, 0.6);
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .bonus-coin-inner {
            width: 64px;
            height: 64px;
            border-radius: 50%;
            border: 2px solid rgba(255, 255, 255, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            font-weight: bold;
            color: #8b4b00;
            background: radial-gradient(circle at 30% 30%, #ffe8a0, #ffbf3d);
        }

        .bonus-amount {
            font-size: 2.5rem;
            color: #d05600;
            text-shadow: 0 4px 10px rgba(255, 255, 255, 0.7);
            min-width: 120px;
            text-align: left;
        }

        .bonus-close-btn {
            min-width: 120px;
            background: linear-gradient(180deg, #ffb931, #ff8a00);
            border: none;
            border-radius: 24px;
            padding: 12px 24px;
            font-family: 'Zen Dots', sans-serif;
            font-size: 1rem;
            color: #3e1d00;
            cursor: pointer;
            box-shadow: 0 6px 18px rgba(255, 138, 0, 0.45);
            transition: transform 0.15s ease;
        }

        .bonus-close-btn:active {
            transform: scale(0.97);
        }

        /* Game Over darkening vignette overlay */
        .game-over-darken {
            position: absolute;
            inset: 0;
            z-index: 2500;
            pointer-events: none;
            opacity: 0;
            background: radial-gradient(ellipse at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.92) 100%);
            transition: opacity 0.9s ease-in;
            border-radius: 12px;
        }
        .game-over-darken.active {
            opacity: 1;
        }

