        /* =========================================================
           Galmuri11 한글 픽셀 웹폰트 (jsdelivr GitHub CDN)
           - 대형 텍스트·타이틀·셀레브레이션에만 선별 적용
           - 가독성 중요한 목록·HUD 라벨은 기존 Courier New 유지
           ========================================================= */
        @font-face {
            font-family: 'Galmuri11';
            src: url('https://cdn.jsdelivr.net/gh/quiple/galmuri/dist/Galmuri11.woff2') format('woff2'),
                 url('https://cdn.jsdelivr.net/npm/galmuri@latest/dist/Galmuri11.woff2') format('woff2');
            font-display: swap;
        }

        /* 픽셀 폰트 적용 대상에 공통 적용할 유틸 스택 (수동 매핑에도 동일 스택 사용) */
        /* 한글 우선: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace */
        /* 영문/숫자 우선: 'Press Start 2P', 'Galmuri11', 'Courier New', monospace */

        body,
        html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            background-color: #87CEEB;
            font-family: 'Courier New', monospace;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
        }

        #arcade-cabinet {
            width: 100%;
            max-width: 900px;
            height: 100%;
            max-height: 1000px;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            box-sizing: border-box;
        }

        #game-container {
            width: 100%;
            max-width: 768px;
            height: 0;
            padding-bottom: 93.75%;
            position: relative;
            border-radius: 10px;
            overflow: hidden;
        }

        #game-area {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #87CEEB;
            transition: background 0.8s ease;
        }

        /* Task #32 — 헬모드 테마 (블랙홀 먹으면 적용) */
        #game-area.mode-hell {
            background: linear-gradient(180deg,
                #1a0505 0%,
                #4a0a0a 28%,
                #8B0000 52%,
                #B8860B 78%,
                #8B6914 95%);
        }
        #game-area.mode-hell::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0; bottom: 0;
            pointer-events: none;
            background:
                radial-gradient(ellipse at 20% 80%, rgba(255, 215, 0, 0.12) 0%, transparent 40%),
                radial-gradient(ellipse at 80% 90%, rgba(255, 69, 0, 0.1) 0%, transparent 50%);
            z-index: 1;
        }
        #game-area.mode-hell #sand {
            background-color: #2a1810;
            background-image:
                repeating-linear-gradient(90deg,
                    rgba(0, 0, 0, 0.3) 0px, rgba(0, 0, 0, 0.3) 2px,
                    transparent 2px, transparent 6px);
        }
        #game-area.mode-hell #water {
            background: linear-gradient(180deg, #5a4a10 0%, #8B6914 40%, #4a3810 100%);
            box-shadow: inset 0 4px 0 rgba(255, 215, 0, 0.3), inset 0 -4px 8px rgba(0, 0, 0, 0.6);
        }

        /* 모드 전환 플래시 오버레이 */
        .mode-swap-flash {
            position: absolute;
            inset: 0;
            z-index: 900;
            pointer-events: none;
            background: radial-gradient(circle at center,
                rgba(255, 255, 255, 0.9) 0%,
                rgba(106, 13, 173, 0.7) 40%,
                rgba(0, 0, 0, 0.95) 100%);
            animation: mode-swap-flash-anim 0.9s ease-out forwards;
        }
        @keyframes mode-swap-flash-anim {
            0%   { opacity: 0; transform: scale(0.1); }
            15%  { opacity: 1; transform: scale(1); }
            60%  { opacity: 1; transform: scale(1); }
            100% { opacity: 0; transform: scale(1.3); }
        }

        /* 블랙홀 아이템 회전 애니메이션 */
        .item.blackhole {
            animation: blackhole-spin 2s linear infinite, float 2s ease-in-out infinite;
        }
        @keyframes blackhole-spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        /* Task #33 — 헬모드 천둥번개 연출 */
        .hell-thunder-flash {
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 800;
            background: radial-gradient(circle at 70% 15%,
                rgba(230, 245, 255, 0.9) 0%,
                rgba(200, 220, 255, 0.45) 30%,
                rgba(180, 200, 240, 0.2) 60%,
                transparent 90%);
            animation: thunder-flash-anim 0.48s ease-out forwards;
        }
        @keyframes thunder-flash-anim {
            0%   { opacity: 0; }
            8%   { opacity: 0.4; }
            14%  { opacity: 0; }
            22%  { opacity: 1; }
            38%  { opacity: 0.5; }
            52%  { opacity: 0.95; }
            70%  { opacity: 0.35; }
            100% { opacity: 0; }
        }

        .hell-thunder-bolt {
            position: absolute;
            top: 0;
            pointer-events: none;
            z-index: 801;
            filter: drop-shadow(0 0 8px #CFE9FF) drop-shadow(0 0 16px #8EC5FF);
            animation: thunder-bolt-anim 0.4s ease-out forwards;
        }
        @keyframes thunder-bolt-anim {
            0%   { opacity: 0; }
            8%   { opacity: 1; }
            22%  { opacity: 0.25; }
            40%  { opacity: 1; }
            60%  { opacity: 0.4; }
            100% { opacity: 0; }
        }

        /* Task #34/#36 — Normal 모드 햇빛 플레어 (시네마틱 렌즈 플레어)
           우상단 태양 코어 + 우상단→좌하단 대각선 광선
           강도 4단계: data-intensity="soft|mid|strong|blind"
           카메라에 햇빛이 잠깐 들어오는 듯한 느낌 */
        .normal-sun-flare {
            position: absolute;
            inset: 0;
            pointer-events: none;
            z-index: 5; /* 캐릭터(10) 뒤, 배경 위 */
            overflow: hidden;
        }
        /* 우상단 태양 코어 — 환한 광원 (mid 기본값) */
        .normal-sun-flare::before {
            content: '';
            position: absolute;
            top: -120px;
            right: -120px;
            width: 480px;
            height: 480px;
            background: radial-gradient(circle,
                rgba(255, 255, 230, 0.95) 0%,
                rgba(255, 248, 180, 0.70) 14%,
                rgba(255, 225, 130, 0.42) 32%,
                rgba(255, 200, 100, 0.20) 55%,
                rgba(255, 180, 80, 0.08) 75%,
                transparent 90%);
            mix-blend-mode: screen;
            filter: blur(2px);
        }
        /* 우상단→좌하단 대각선 광선 (god ray) (mid 기본값) */
        .normal-sun-flare::after {
            content: '';
            position: absolute;
            top: -40%;
            right: -30%;
            width: 220%;
            height: 260px;
            background: linear-gradient(90deg,
                transparent 0%,
                rgba(255, 248, 200, 0.30) 20%,
                rgba(255, 245, 190, 0.55) 45%,
                rgba(255, 240, 170, 0.65) 55%,
                rgba(255, 230, 150, 0.35) 75%,
                transparent 100%);
            transform: rotate(-32deg);
            transform-origin: right center;
            mix-blend-mode: screen;
            filter: blur(10px);
        }

        /* === 강도 4단계 === */
        /* SOFT — 잔잔한 햇빛: 작은 코어, 얇은 광선, 낮은 피크 */
        .normal-sun-flare[data-intensity="soft"] {
            animation: sun-flare-soft 3.2s ease-in-out forwards;
        }
        .normal-sun-flare[data-intensity="soft"]::before {
            width: 360px; height: 360px;
            top: -90px; right: -90px;
        }
        .normal-sun-flare[data-intensity="soft"]::after {
            height: 180px;
        }
        @keyframes sun-flare-soft {
            0%   { opacity: 0; }
            18%  { opacity: 0.45; }
            40%  { opacity: 0.55; }
            70%  { opacity: 0.40; }
            100% { opacity: 0; }
        }

        /* MID — 평소 강도 (기본값) */
        .normal-sun-flare[data-intensity="mid"] {
            animation: sun-flare-mid 3.5s ease-in-out forwards;
        }
        @keyframes sun-flare-mid {
            0%   { opacity: 0; }
            15%  { opacity: 0.65; }
            30%  { opacity: 0.95; }
            60%  { opacity: 0.85; }
            100% { opacity: 0; }
        }

        /* STRONG — 환한 햇빛: 큰 코어, 두꺼운 광선, 높은 피크 */
        .normal-sun-flare[data-intensity="strong"] {
            animation: sun-flare-strong 3.8s ease-in-out forwards;
        }
        .normal-sun-flare[data-intensity="strong"]::before {
            width: 560px; height: 560px;
            top: -140px; right: -140px;
            background: radial-gradient(circle,
                rgba(255, 255, 240, 1) 0%,
                rgba(255, 250, 200, 0.85) 12%,
                rgba(255, 235, 150, 0.55) 30%,
                rgba(255, 210, 110, 0.28) 55%,
                rgba(255, 190, 90, 0.10) 75%,
                transparent 90%);
        }
        .normal-sun-flare[data-intensity="strong"]::after {
            height: 320px;
            background: linear-gradient(90deg,
                transparent 0%,
                rgba(255, 250, 210, 0.45) 18%,
                rgba(255, 245, 195, 0.70) 45%,
                rgba(255, 240, 175, 0.80) 55%,
                rgba(255, 230, 155, 0.45) 78%,
                transparent 100%);
        }
        @keyframes sun-flare-strong {
            0%   { opacity: 0; }
            14%  { opacity: 0.85; }
            32%  { opacity: 1; }
            65%  { opacity: 0.95; }
            100% { opacity: 0; }
        }

        /* BLIND — 눈부신 빛: 매우 큰 광원, 화면 전체 화이트 워시, 가장 길게 잔존 */
        .normal-sun-flare[data-intensity="blind"] {
            animation: sun-flare-blind 4.2s ease-in-out forwards;
            background: radial-gradient(ellipse at 85% 12%,
                rgba(255, 255, 250, 0.55) 0%,
                rgba(255, 250, 220, 0.35) 25%,
                rgba(255, 245, 200, 0.18) 50%,
                rgba(255, 240, 180, 0.05) 75%,
                transparent 100%);
        }
        .normal-sun-flare[data-intensity="blind"]::before {
            width: 680px; height: 680px;
            top: -180px; right: -180px;
            background: radial-gradient(circle,
                rgba(255, 255, 255, 1) 0%,
                rgba(255, 255, 240, 0.95) 8%,
                rgba(255, 248, 180, 0.78) 22%,
                rgba(255, 225, 130, 0.50) 45%,
                rgba(255, 200, 100, 0.25) 68%,
                rgba(255, 180, 80, 0.08) 82%,
                transparent 95%);
            filter: blur(1px);
        }
        .normal-sun-flare[data-intensity="blind"]::after {
            height: 420px;
            background: linear-gradient(90deg,
                transparent 0%,
                rgba(255, 252, 230, 0.55) 15%,
                rgba(255, 248, 210, 0.85) 42%,
                rgba(255, 245, 195, 0.95) 55%,
                rgba(255, 235, 165, 0.55) 80%,
                transparent 100%);
            filter: blur(8px);
        }
        @keyframes sun-flare-blind {
            0%   { opacity: 0; }
            10%  { opacity: 0.75; }
            22%  { opacity: 1; }
            45%  { opacity: 1; }
            72%  { opacity: 0.65; }
            100% { opacity: 0; }
        }

        /* 모드 전환·헬모드 진입 시 플레어 즉시 숨김 */
        #game-area.mode-hell .normal-sun-flare { display: none; }

        #crab,
        .shell,
        .cloud {
            position: absolute;
            will-change: transform;
            transform: translateZ(0);
            backface-visibility: hidden;
            z-index: 10;
        }

        .item {
            position: absolute;
            animation: float 2s ease-in-out infinite;
            z-index: 10;
        }

        #title,
        #game-over,
        #retry-button,
        #lives,
        #combo {
            position: absolute;
            color: #FFF;
            text-shadow: 2px 2px 0px #000;
            text-transform: uppercase;
        }

        #score {
            top: 16px;
            left: 16px;
            font-size: 22px;
            background: rgba(0, 0, 0, 0.55);
            padding: 5px 14px;
            border-radius: 10px;
            border: 1px solid rgba(255, 215, 0, 0.3);
            text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
        }

        #score .score-num {
            color: #FFD700;
            font-size: 28px;
            font-weight: bold;
            text-shadow: 2px 2px 0 #000, 0 0 8px rgba(255, 215, 0, 0.5);
            font-family: 'Press Start 2P', 'Galmuri11', 'Courier New', monospace;
        }

        #level-display {
            position: absolute;
            top: 120px;
            right: 16px;
            font-size: 24px;
            color: #FF4500;
            /* Red-Orange */
            font-weight: bold;
            text-shadow: 2px 2px 0px #000;
            text-align: right;
            font-family: 'Press Start 2P', 'Galmuri11', 'Courier New', monospace;
        }

        #lives {
            top: 56px;
            right: 16px;
            font-size: 40px;
        }

        #combo {
            top: 56px;
            left: 16px;
            font-size: 24px;
            color: #FFD700;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
        }

        #title {
            top: 96px;
            left: 16px;
            font-size: 32px;
            text-align: left;
            color: #FFD700;
            font-weight: bold;
            text-shadow: 3px 3px 0px #000, 0 0 10px #FFA500;
            letter-spacing: 1px;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
        }

        #game-over {
            top: 40%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 64px;
            display: none;
            text-align: center;
            width: 100%;
            font-family: 'Press Start 2P', 'Galmuri11', 'Courier New', monospace;
            letter-spacing: 2px;
        }

        #high-score-entry {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.9);
            padding: 30px;
            border-radius: 15px;
            border: 4px solid #FFD700;
            display: none;
            text-align: center;
            z-index: 100;
        }

        #high-score-entry h2 {
            color: #FFD700;
            margin-bottom: 20px;
            font-size: 32px;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
            letter-spacing: 1px;
        }

        #high-score-entry input {
            font-family: 'Courier New', monospace;
            font-size: 24px;
            padding: 10px;
            width: 200px;
            text-align: center;
            text-transform: uppercase;
            border: 2px solid #FFD700;
            background: #000;
            color: #FFF;
            margin-bottom: 20px;
        }

        #high-score-entry button {
            font-family: 'Courier New', monospace;
            font-size: 24px;
            padding: 10px 30px;
            background: #FFD700;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            text-transform: uppercase;
        }

        #high-score-entry button:hover {
            background: #FFA500;
        }

        #high-scores {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.95);
            padding: 24px 24px 20px;
            border-radius: 15px;
            border: 4px solid #FFD700;
            display: none;
            flex-direction: column;
            text-align: center;
            z-index: 100;
            min-width: 420px;
            width: min(520px, 92vw);
            max-height: 85vh;
        }

        #high-scores.is-visible {
            display: flex;
        }

        #high-scores .scores-header {
            flex: 0 0 auto;
            border-bottom: 1px solid #444;
            padding-bottom: 10px;
            margin-bottom: 10px;
        }

        #high-scores h2 {
            color: #FFD700;
            margin: 0 0 6px 0;
            font-size: 32px;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
            letter-spacing: 1px;
        }

        #scores-summary {
            color: #FFD700cc;
            font-size: 14px;
            margin: 0;
            letter-spacing: 0.02em;
        }

        #scores-summary strong {
            color: #FFF;
            font-weight: bold;
        }

        #high-scores .scores-scroll {
            flex: 1 1 auto;
            overflow-y: auto;
            padding: 0 4px;
            /* 스크롤바 미니멀 */
            scrollbar-width: thin;
            scrollbar-color: #FFD70066 #00000000;
        }

        #high-scores .scores-scroll::-webkit-scrollbar {
            width: 6px;
        }

        #high-scores .scores-scroll::-webkit-scrollbar-thumb {
            background: #FFD70066;
            border-radius: 3px;
        }

        #high-scores table {
            width: 100%;
            color: #FFF;
            font-size: 18px;
            border-collapse: collapse;
        }

        #high-scores td {
            padding: 6px 8px;
            border-bottom: 1px solid #333;
        }

        #high-scores .rank {
            color: #FFD700;
            font-weight: bold;
            width: 56px;
            text-align: center;
        }

        #high-scores .name {
            text-align: left;
            padding-left: 16px;
        }

        #high-scores .score {
            text-align: right;
            padding-right: 16px;
            font-variant-numeric: tabular-nums;
        }

        /* 티어링: 메달(1~3) / 골드(4~10) / 실버(11~20) / 일반(21~100) / 빈 슬롯 */
        #high-scores .row-medal .rank { font-size: 22px; }
        #high-scores .row-medal .name { color: #FFFFFF; font-weight: bold; }
        #high-scores .row-gold { background: rgba(255, 215, 0, 0.06); }
        #high-scores .row-gold .name { color: #FFE066; }
        #high-scores .row-silver .name { color: #D0D6DC; }
        #high-scores .row-rest td { color: #AAA; font-size: 16px; padding: 4px 8px; }
        #high-scores .row-rest .rank { color: #888; font-weight: normal; }
        #high-scores .row-empty td { color: #555; font-style: italic; }
        #high-scores .row-empty .rank { color: #555; }

        /* 21~100위 토글 */
        #scores-toggle-btn {
            display: block;
            width: 100%;
            margin: 14px 0 8px;
            padding: 8px 12px;
            background: transparent;
            color: #FFD700;
            border: 1px dashed #FFD70066;
            border-radius: 8px;
            font-family: 'Courier New', monospace;
            font-size: 14px;
            letter-spacing: 0.02em;
            cursor: pointer;
            text-transform: none;
        }

        #scores-toggle-btn:hover:not(.is-disabled) {
            background: #FFD70015;
            border-color: #FFD700aa;
        }

        #scores-toggle-btn.is-disabled {
            color: #666;
            border-color: #444;
            cursor: not-allowed;
        }

        .scores-rest {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.35s ease;
        }

        .scores-rest.is-open {
            max-height: 2000px;
        }

        /* 닫기 버튼 (하단 고정) */
        #close-scores {
            flex: 0 0 auto;
            font-family: 'Courier New', monospace;
            font-size: 20px;
            padding: 10px 30px;
            background: #FF6347;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            margin-top: 14px;
            color: #FFF;
            text-transform: uppercase;
        }

        #close-scores:hover {
            background: #FF4500;
        }

        /* 100위 진입 LEGEND 토스트 */
        #legend-toast {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0.85);
            background: linear-gradient(135deg, #1e293b, #000);
            border: 4px solid #FFD700;
            border-radius: 18px;
            padding: 28px 42px;
            color: #FFF;
            text-align: center;
            z-index: 9999;
            opacity: 0;
            transition: all 0.45s cubic-bezier(.22,1.2,.36,1);
            box-shadow: 0 0 60px #FFD70088, 0 0 120px #FFA50055;
            pointer-events: none;
        }

        #legend-toast.show {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }

        #legend-toast .legend-burst {
            font-size: 44px;
            margin-bottom: 6px;
            letter-spacing: 8px;
            animation: legend-burst 1.5s ease-in-out infinite;
        }

        #legend-toast .legend-title {
            font-family: 'Courier New', monospace;
            font-size: 40px;
            font-weight: bold;
            color: #FFD700;
            letter-spacing: 4px;
            text-shadow: 0 0 18px #FFA500;
        }

        #legend-toast .legend-sub {
            margin-top: 10px;
            font-size: 16px;
            color: #FFFBE6;
        }

        @keyframes legend-burst {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.15); }
        }

        /* 게임 설명 패널 */
        #help-panel {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.95);
            padding: 24px;
            border-radius: 15px;
            border: 4px solid #FFD700;
            display: none;
            text-align: left;
            z-index: 110;
            min-width: 380px;
            max-width: 460px;
            max-height: 85%;
            overflow-y: auto;
            color: #FFF;
            font-size: 15px;
            line-height: 1.5;
        }

        #help-panel h2 {
            color: #FFD700;
            text-align: center;
            margin-bottom: 16px;
            font-size: 28px;
        }

        #help-panel h3 {
            color: #FF6347;
            font-size: 16px;
            margin-bottom: 8px;
            border-bottom: 1px solid #444;
            padding-bottom: 4px;
        }

        .help-section {
            margin-bottom: 16px;
        }

        .help-section p {
            margin: 4px 0;
        }

        .help-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }

        .help-table tr {
            border-bottom: 1px solid rgba(255,255,255,0.1);
        }

        .help-table td {
            padding: 5px 6px;
            vertical-align: middle;
        }

        .help-table .ht-icon {
            width: 30px;
            text-align: center;
            font-size: 18px;
        }

        .help-table .ht-label {
            font-weight: bold;
            color: #FFD700;
            white-space: nowrap;
            width: 90px;
        }

        #help-btn-gameover {
            position: absolute;
            top: 72%;
            left: 50%;
            transform: translateX(-50%);
            font-family: 'Courier New', monospace;
            font-size: 16px;
            padding: 6px 16px;
            background: #FFD700;
            border: 2px solid #FFF;
            border-radius: 5px;
            color: #000;
            font-weight: bold;
            cursor: pointer;
            z-index: 20;
            text-shadow: none;
        }

        #help-btn-gameover:hover {
            background: #FFA500;
        }

        #close-help {
            display: block;
            margin: 16px auto 0;
            font-family: 'Courier New', monospace;
            font-size: 20px;
            padding: 8px 30px;
            background: #FF6347;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            color: #FFF;
        }

        #close-help:hover {
            background: #FF4500;
        }

        /* 상단 우측 HUD 버튼 페어(🏆 랭킹 + 🔊 BGM) — 동일한 아이콘 버튼 톤으로 통일 */
        #view-scores-btn {
            position: absolute;
            top: 16px;
            right: 16px;
            font-size: 22px;
            padding: 4px 10px;
            background: rgba(0, 0, 0, 0.4);
            border: 2px solid rgba(255, 255, 255, 0.5);
            border-radius: 5px;
            cursor: pointer;
            color: #FFD700;
            z-index: 10;
            line-height: 1;
            transition: background 0.2s, color 0.2s;
        }

        #view-scores-btn:hover {
            background: rgba(0, 0, 0, 0.7);
            color: #FFA500;
        }

        #bgm-toggle {
            position: absolute;
            top: 16px;
            right: 62px;
            font-size: 22px;
            padding: 4px 10px;
            background: rgba(0, 0, 0, 0.4);
            border: 2px solid rgba(255, 255, 255, 0.5);
            border-radius: 5px;
            cursor: pointer;
            color: #FFF;
            z-index: 10;
            line-height: 1;
            transition: background 0.2s;
        }

        #bgm-toggle:hover {
            background: rgba(0, 0, 0, 0.7);
        }

        #law-firm-link {
            position: absolute;
            bottom: 12px;
            left: 12px;
            font-family: 'Courier New', monospace;
            font-size: 13px;
            color: rgba(255, 255, 255, 0.6);
            text-shadow: 1px 1px 0px #000;
            text-align: left;
            line-height: 1.3;
            cursor: pointer;
            text-decoration: none;
            z-index: 10;
        }

        #law-firm-link:hover {
            color: #FFD700;
            text-shadow: 1px 1px 0px #000, 0 0 8px #FFD700;
        }

        #retry-button {
            top: 60%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 32px;
            padding: 10px 20px;
            background-color: #FF6347;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            display: none;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
            letter-spacing: 1px;
        }

        #retry-button:hover {
            background-color: #FF4500;
        }

        #sand {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 96px;
            background-color: #DAA520;
        }

        #water {
            position: absolute;
            bottom: 96px;
            width: 100%;
            height: 48px;
            background-color: #1E90FF;
        }

        #start-screen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            cursor: pointer;
        }

        #start-screen h1 {
            font-size: 48px;
            color: #FFD700;
            text-shadow: 4px 4px 0 #000;
            margin-bottom: 20px;
            text-align: center;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
            letter-spacing: 2px;
        }

        #start-screen p {
            font-size: 24px;
            color: #FFF;
            animation: pulse 1.5s infinite;
            text-align: center;
            line-height: 1.5;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
        }

        .item {
            position: absolute;
            animation: float 2s ease-in-out infinite;
        }

        @keyframes float {

            0%,
            100% {
                transform: translateY(0px);
            }

            50% {
                transform: translateY(-10px);
            }
        }

        @keyframes pulse {

            0%,
            100% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.2);
            }
        }

        .star {
            animation: float 2s ease-in-out infinite, pulse 1s ease-in-out infinite;
        }

        #controls {
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            text-align: center;
            color: #FF4500;
            font-weight: bold;
            font-size: 18px;
            text-shadow: 2px 2px 0px #000, 0 0 6px rgba(0,0,0,0.85);
            display: none;
        }

        #mobile-controls {
            position: fixed;
            bottom: 30px;
            right: 30px;
            z-index: 1000;
            display: none;
        }

        #mobile-instruction {
            position: fixed;
            bottom: 180px;
            right: 30px;
            text-align: right;
            color: #FF4500;
            font-weight: bold;
            font-size: 16px;
            text-shadow: 2px 2px 0px #000, 0 0 6px rgba(0,0,0,0.85);
            z-index: 1000;
            display: none;
            max-width: 200px;
        }

        #jump-button {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            background: linear-gradient(145deg, #FF6347, #FF4500);
            border: 4px solid #FFF;
            color: #FFF;
            font-size: 28px;
            font-weight: bold;
            text-shadow: 2px 2px 0px #000;
            cursor: pointer;
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
            touch-action: manipulation;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        #jump-button:active {
            background: linear-gradient(145deg, #FF4500, #FF6347);
            transform: scale(0.95);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
        }

        @media (max-width: 768px) {
            #arcade-cabinet {
                padding: 0;
                max-height: none;
            }

            #game-container {
                max-width: 100%;
                height: 100%;
                padding-bottom: 0;
                border-radius: 0;
            }

            #controls {
                display: none;
            }

            #mobile-controls {
                display: block;
            }

            #mobile-instruction {
                display: block;
            }

            #score {
                font-size: 18px;
                top: 10px;
                left: 10px;
                padding: 4px 10px;
            }

            #score .score-num {
                font-size: 22px;
            }

            #level-display {
                font-size: 20px;
                top: 100px;
                left: auto;
                right: 12px;
                text-align: right;
            }

            /* 모바일: 두 아이콘 버튼 모두 동일 사이즈로 페어 구성 */
            #view-scores-btn {
                font-size: 18px;
                padding: 3px 8px;
                right: 10px;
                top: 10px;
            }

            #bgm-toggle {
                right: 52px;
                top: 10px;
                font-size: 18px;
                padding: 3px 8px;
            }

            #law-firm-link {
                font-size: 11px;
                bottom: 8px;
                left: 8px;
            }

            #lives {
                font-size: 32px;
                top: 46px;
                right: 12px;
            }

            #combo {
                font-size: 20px;
                top: 48px;
                left: 12px;
            }

            #title {
                font-size: 24px;
                top: 90px;
                left: 12px;
            }

            #game-over {
                /* Press Start 2P는 Courier보다 장폭이 좁아 "GAME OVER" 8글자가 모바일에서 빠듯.
                   48px → 40px로 낮춰 안전 마진 확보 */
                font-size: 40px;
                letter-spacing: 1px;
            }

            .celebration-text {
                /* Galmuri11 한글은 Courier 대비 시각적 폭이 살짝 넓음.
                   긴 문구("생명 만땅 특별 보너스 x3!") 안전 여유 위해 32px → 28px */
                font-size: 28px;
            }

            #jump-button {
                width: 100px;
                height: 100px;
                font-size: 24px;
            }

            #mobile-controls {
                bottom: 20px;
                right: 20px;
            }

            #mobile-instruction {
                bottom: 140px;
                right: 20px;
                font-size: 14px;
            }

            #retry-button {
                font-size: 24px;
                padding: 8px 16px;
            }

            #high-scores {
                min-width: 90%;
                max-width: 94%;
                width: 94vw;
                padding: 14px 12px 12px;
                max-height: 85vh;
            }

            #high-scores h2 {
                font-size: 22px;
                margin-bottom: 4px;
            }

            #scores-summary {
                font-size: 12px;
            }

            #high-scores table {
                font-size: 14px;
            }

            #high-scores td {
                padding: 4px 6px;
            }

            #high-scores .rank {
                width: 40px;
            }

            #high-scores .name {
                padding-left: 10px;
            }

            #high-scores .score {
                padding-right: 10px;
            }

            #scores-toggle-btn {
                font-size: 13px;
                margin: 10px 0 6px;
                padding: 7px 10px;
            }

            #close-scores {
                font-size: 16px;
                padding: 8px 20px;
                margin-top: 10px;
            }

            #legend-toast {
                padding: 22px 28px;
            }

            #legend-toast .legend-burst { font-size: 34px; }
            #legend-toast .legend-title { font-size: 30px; letter-spacing: 2px; }
            #legend-toast .legend-sub { font-size: 13px; }

            #help-panel {
                min-width: 88%;
                max-width: 92%;
                padding: 16px;
                max-height: 80%;
                font-size: 13px;
            }

            #help-panel h2 {
                font-size: 22px;
                margin-bottom: 12px;
            }

            #help-panel h3 {
                font-size: 14px;
            }

            .help-table {
                font-size: 12px;
            }



            #help-btn-gameover {
                font-size: 14px;
                top: 74%;
                padding: 5px 12px;
            }

            #high-score-entry {
                width: 85%;
                padding: 20px;
            }

            #high-score-entry h2 {
                font-size: 24px;
            }

            #high-score-entry input {
                font-size: 20px;
                width: 150px;
            }

            #sand {
                height: 200px;
            }

            #water {
                bottom: 200px;
            }
        }

        @media (min-width: 769px) and (max-width: 1024px) {
            #controls {
                display: none;
            }

            #mobile-controls {
                display: block;
            }

            #mobile-instruction {
                display: block;
            }
        }

        @media (min-width: 1025px) {
            #controls {
                display: block;
            }

            #mobile-controls {
                display: none;
            }

            #mobile-instruction {
                display: none;
            }
        }

        @keyframes run-wobble {
            0% {
                transform: scaleY(0.95) rotate(0deg);
            }

            100% {
                transform: scaleY(1.05) rotate(0deg);
            }
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        /* 보스 바위 굴러가는 애니메이션 */
        @keyframes roll {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(-360deg);
            }
        }

        .rolling-boss {
            animation: roll 1s linear infinite;
        }

        /* 둥둥 떠다니는 서류 애니메이션 */
        .floating-shell {
            animation: float-paper 1.5s ease-in-out infinite alternate;
        }

        @keyframes float-paper {
            0% {
                transform: translateY(0) rotate(0deg);
            }

            100% {
                transform: translateY(-15px) rotate(3deg);
            }
        }

        .cape {
            position: absolute;
            z-index: 9;
            /* 캐릭터(z-index: 10) 뒤에 위치 */
            transform-origin: right top;
            /* 목덜미(오른쪽 위)를 기준으로 펄럭임 */
            animation: cape-flutter 0.2s ease-in-out infinite alternate;
            display: none;
            /* 기본적으로 숨김 */
            pointer-events: none;
        }

        @keyframes cape-flutter {
            0% {
                transform: rotate(5deg) scaleX(1) skewY(0deg);
            }

            100% {
                transform: rotate(0deg) scaleX(0.9) skewY(5deg);
            }
        }

        .crab-run {
            animation: run-wobble 0.15s ease-in-out infinite alternate;
        }

        .crab-jump {
            transform: rotate(-10deg);
        }

        .crab-double-jump {
            animation: spin 0.4s linear infinite;
        }

        .celebration-text-animation {
            animation: pop-up 0.5s ease-out forwards;
        }

        @keyframes shake {
            0% {
                transform: translate(1px, 1px) rotate(0deg);
            }

            10% {
                transform: translate(-1px, -2px) rotate(-1deg);
            }

            20% {
                transform: translate(-3px, 0px) rotate(1deg);
            }

            30% {
                transform: translate(3px, 2px) rotate(0deg);
            }

            40% {
                transform: translate(1px, -1px) rotate(1deg);
            }

            50% {
                transform: translate(-1px, 2px) rotate(-1deg);
            }

            60% {
                transform: translate(-3px, 1px) rotate(0deg);
            }

            70% {
                transform: translate(3px, 1px) rotate(-1deg);
            }

            80% {
                transform: translate(-1px, -1px) rotate(1deg);
            }

            90% {
                transform: translate(1px, 2px) rotate(0deg);
            }

            100% {
                transform: translate(0, 0) rotate(0deg);
            }
        }

        .shake-effect {
            animation: shake 0.3s cubic-bezier(.36, .07, .19, .97) both;
        }

        .celebration-text {
            position: absolute;
            /* 데스크탑·모바일 공통 중앙정렬 — JS에서 전달하는 x좌표와 무관하게
               축하 텍스트는 게임 영역 정중앙에 배치한다.
               (explosionX가 화면 우측 근처일 때 텍스트가 잘리는 버그 해결) */
            left: 50% !important;
            width: 100%;
            text-align: center;
            font-size: 48px;
            font-weight: bold;
            color: #FFD700;
            text-shadow: 3px 3px 0px #000, 0 0 20px #FFD700;
            z-index: 200;
            pointer-events: none;
            animation: celebration-pop 1.5s ease-out forwards;
            white-space: nowrap;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
            letter-spacing: 1px;
        }

        @keyframes celebration-pop {
            0% {
                transform: translate(-50%, -50%) scale(0) rotate(-10deg);
                opacity: 0;
            }

            20% {
                transform: translate(-50%, -50%) scale(1.3) rotate(5deg);
                opacity: 1;
            }

            80% {
                transform: translate(-50%, -50%) scale(1) rotate(0deg);
                opacity: 1;
            }

            100% {
                transform: translate(-50%, -50%) scale(0.8) translateY(-50px);
                opacity: 0;
            }
        }

        .firework {
            position: absolute;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            z-index: 199;
            pointer-events: none;
        }

        .level-up-text {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 36px;
            font-weight: bold;
            color: #FF6347;
            text-shadow: 3px 3px 0px #000, 0 0 15px #FF6347;
            z-index: 300;
            pointer-events: none;
            animation: level-up-pop 1.5s ease-out forwards;
            white-space: nowrap;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
            letter-spacing: 1px;
        }

        @keyframes level-up-pop {
            0% {
                transform: translate(-50%, -50%) scale(0);
                opacity: 0;
            }

            15% {
                transform: translate(-50%, -50%) scale(1.4);
                opacity: 1;
            }

            70% {
                transform: translate(-50%, -50%) scale(1);
                opacity: 1;
            }

            100% {
                transform: translate(-50%, -50%) scale(0.8) translateY(-30px);
                opacity: 0;
            }
        }

        @media (max-width: 768px) {
            .level-up-text {
                font-size: 28px;
            }

            .celebration-text {
                /* 모바일은 폰트 크기만 축소. 중앙정렬은 기본 규칙에서 처리 */
                font-size: 28px;
            }
        }

        @keyframes firework-burst {
            0% {
                transform: translate(0, 0) scale(1);
                opacity: 1;
            }

            100% {
                opacity: 0;
            }
        }

        /* ═══════════════════════════════════════════════════════════════
           확정판결 보스 경고 배너 — Pity 첫 조우 예고 (Task #29 + #30)
           우측→좌측 슬라이드 + 양쪽 빨간 경고등 점멸 (2.2초)
           ═══════════════════════════════════════════════════════════════ */
        .final-boss-warning {
            position: absolute;
            top: 30%;
            left: 0;
            z-index: 500;
            pointer-events: none;
            padding: 14px 28px;
            font-family: 'Galmuri11', 'Press Start 2P', 'Courier New', monospace;
            font-size: 32px;
            font-weight: 900;
            color: #FFD700;
            background: linear-gradient(90deg,
                    rgba(0, 0, 0, 0.94) 0%,
                    rgba(139, 0, 0, 0.94) 50%,
                    rgba(0, 0, 0, 0.94) 100%);
            border: 3px solid #FFD700;
            border-radius: 6px;
            text-shadow:
                2px 2px 0px #8B0000,
                -2px -2px 0px #8B0000,
                0 0 14px #FFD700,
                0 0 28px #FF4500;
            box-shadow:
                0 0 16px rgba(255, 215, 0, 0.8),
                0 0 32px rgba(139, 0, 0, 0.9),
                inset 0 0 12px rgba(255, 69, 0, 0.5);
            white-space: nowrap;
            letter-spacing: 3px;
            display: flex;
            align-items: center;
            gap: 18px;
            animation: final-boss-slide 2.2s linear forwards;
        }

        /* 양쪽 빨간 경고등 — 빠른 점멸 */
        .final-boss-warning::before,
        .final-boss-warning::after {
            content: '';
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: radial-gradient(circle, #FF0000 30%, #8B0000 100%);
            animation: warn-light-blink 0.22s infinite alternate;
            flex-shrink: 0;
        }

        .final-boss-warning::after {
            animation-delay: -0.11s; /* 반대 위상 점멸 */
        }

        @keyframes warn-light-blink {
            0% {
                opacity: 0.25;
                box-shadow: 0 0 4px 1px rgba(255, 0, 0, 0.3);
                transform: scale(0.85);
            }

            100% {
                opacity: 1;
                box-shadow:
                    0 0 14px 5px rgba(255, 0, 0, 0.95),
                    0 0 28px 10px rgba(255, 69, 0, 0.7),
                    0 0 44px 16px rgba(255, 215, 0, 0.4);
                transform: scale(1);
            }
        }

        /* 우측 끝 → 좌측 끝 수평 슬라이드 */
        @keyframes final-boss-slide {
            0% {
                left: 100%;
                opacity: 0.3;
            }

            10% {
                opacity: 1;
            }

            90% {
                opacity: 1;
            }

            100% {
                left: -100%;
                opacity: 0.3;
            }
        }

        @media (max-width: 768px) {
            .final-boss-warning {
                font-size: 22px;
                padding: 10px 18px;
                letter-spacing: 2px;
                gap: 12px;
            }

            .final-boss-warning::before,
            .final-boss-warning::after {
                width: 16px;
                height: 16px;
            }
        }

        /* ═══════════════════════════════════════════════════════════════
           최종보스 등장 시 화면 흔들림 (Task #30)
           ═══════════════════════════════════════════════════════════════ */
        .screen-shake {
            animation: screen-quake 0.12s infinite;
        }

        @keyframes screen-quake {
            0%   { transform: translate(0, 0); }
            20%  { transform: translate(-3px, 1px); }
            40%  { transform: translate(3px, -2px); }
            60%  { transform: translate(-2px, 2px); }
            80%  { transform: translate(2px, -1px); }
            100% { transform: translate(0, 0); }
        }
