        * {
            margin: 0;
            padding: 0;
        }
        html, body {
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        html:has(body.game-running), body.game-running {
            overflow: hidden;
        }
        body {
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            height: 100vh;
            height: 100dvh;
            background: #000;
            font-family: Arial, sans-serif;
            overflow: hidden;
            position: relative;
        }
        #starfield {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            height: 100dvh;
            min-height: 100%;
            z-index: 0;
            display: block;
            object-fit: fill;
            border: none;
            margin: 0;
            padding: 0;
        }
        .header {
            display: none;
        }
        .title {
            font-size: 3.5vh;
            font-weight: bold;
            font-family: 'Orbitron', sans-serif;
            background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-shadow: none;
            letter-spacing: 0.3vh;
            position: relative;
            z-index: 1;
            filter: drop-shadow(0 0.2vh 0.4vh rgba(255, 215, 0, 0.5))
                    drop-shadow(0 0.4vh 0.8vh rgba(0, 0, 0, 0.7));
        }
        @keyframes titlePulse {
            0%, 100% { 
                filter: drop-shadow(0 0.2vh 0.4vh rgba(255, 215, 0, 0.5))
                        drop-shadow(0 0.4vh 0.8vh rgba(0, 0, 0, 0.7));
            }
            50% { 
                filter: drop-shadow(0 0.3vh 0.6vh rgba(255, 215, 0, 0.8))
                        drop-shadow(0 0.4vh 0.8vh rgba(0, 0, 0, 0.7));
            }
        }
        .content-area {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 0.5vh 0.5vw 0.5vh 0.5vw;
            position: relative;
            z-index: 1;
            height: 100vh;
            height: 100dvh;
            box-sizing: border-box;
            width: 100%;
            overflow: visible; /* Allow next piece queue to extend beyond */
        }
        .game-container {
            display: flex;
            justify-content: space-between;
            align-items: stretch;
            gap: 4vw;
            position: relative;
            z-index: 1;
            height: 96vh;
            width: 100%; /* Use full width */
            max-width: 100%; /* Prevent overflow */
            margin: 0 auto;
            box-sizing: border-box;
            overflow: visible;
        }
        .main-area {
            background: transparent;
            padding: 0;
            border-radius: 1vh;
            position: relative;
            height: 100%;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center; /* Center content vertically */
            flex-shrink: 0; /* Prevent shrinking */
            flex-grow: 1; /* Allow growing to take available space */
            min-width: 0; /* Allow shrinking below content width */
            overflow: hidden; /* Prevent content from extending beyond bounds */
        }
        /* Allow tooltip overflow when mode menu is visible */
        .main-area:has(.mode-menu:not(.hidden)) {
            overflow: visible;
        }
        /* Vertigo challenge wrapper - transparent to layout when inactive,
           JS applies oscillating transform when active */
        #vertigoWrapper {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        canvas {
            border: 0.3vh solid rgba(255, 255, 255, 0.5);
            display: block;
            background: transparent;
            box-shadow: 0 0 2vh rgba(0, 0, 0, 0.5);
            max-height: 100%;
            transition: border-color 0.3s, box-shadow 0.3s;
        }
        .vineOverlay {
            border: none !important;
            box-shadow: none !important;
            max-height: none !important;
            transition: none !important;
            pointer-events: none !important;
        }
        .vineWrapper {
            display: inline-block;
            position: relative;
            pointer-events: none;
        }
        .vineWrapper > canvas:first-child {
            pointer-events: auto;
        }
        canvas.tsunami-active {
            border-color: gold;
            box-shadow: 0 0 3vh rgba(255, 215, 0, 0.8), 0 0 1vh rgba(255, 215, 0, 0.6);
            animation: tsunamiPulse 0.5s ease-in-out infinite alternate;
        }
        @keyframes tsunamiPulse {
            from {
                box-shadow: 0 0 3vh rgba(255, 215, 0, 0.8), 0 0 1vh rgba(255, 215, 0, 0.6);
            }
            to {
                box-shadow: 0 0 4vh rgba(255, 215, 0, 1), 0 0 2vh rgba(255, 215, 0, 0.8);
            }
        }
        canvas.blackhole-active {
            border-color: #8b00ff;
            box-shadow: 0 0 3vh rgba(139, 0, 255, 0.9), 0 0 1.5vh rgba(75, 0, 130, 0.7);
            animation: blackholePulse 0.4s ease-in-out infinite alternate;
        }
        @keyframes blackholePulse {
            from {
                box-shadow: 0 0 3vh rgba(139, 0, 255, 0.9), 0 0 1.5vh rgba(75, 0, 130, 0.7);
            }
            to {
                box-shadow: 0 0 5vh rgba(139, 0, 255, 1), 0 0 3vh rgba(75, 0, 130, 0.9), inset 0 0 2vh rgba(139, 0, 255, 0.5);
            }
        }
        canvas.touchdown-active {
            border-color: #00ff00;
            box-shadow: 0 0 3vh rgba(0, 255, 0, 0.9), 0 0 2vh rgba(0, 200, 0, 0.7);
            animation: touchdownPulse 0.3s ease-in-out infinite alternate;
        }
        @keyframes touchdownPulse {
            from {
                box-shadow: 0 0 3vh rgba(0, 255, 0, 0.9), 0 0 2vh rgba(0, 200, 0, 0.7);
            }
            to {
                box-shadow: 0 0 6vh rgba(0, 255, 0, 1), 0 0 4vh rgba(0, 200, 0, 0.9), inset 0 0 2vh rgba(0, 255, 0, 0.5);
            }
        }
        
        /* Nervous mode shake animation */
        @keyframes nervousShake {
            0%, 100% { transform: translate(0, 0); }
            10% { transform: translate(-0.5vh, 0.3vh); }
            20% { transform: translate(0.6vh, -0.4vh); }
            30% { transform: translate(-0.4vh, 0.6vh); }
            40% { transform: translate(0.5vh, -0.3vh); }
            50% { transform: translate(-0.6vh, 0.4vh); }
            60% { transform: translate(0.3vh, -0.6vh); }
            70% { transform: translate(-0.4vh, 0.3vh); }
            80% { transform: translate(0.6vh, -0.5vh); }
            90% { transform: translate(-0.3vh, 0.5vh); }
        }
        
        @keyframes nervousShakeLongAgo {
            0%, 100% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(0, 0); }
            10% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.5vh, 0.3vh); }
            20% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(0.6vh, -0.4vh); }
            30% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.4vh, 0.6vh); }
            40% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(0.5vh, -0.3vh); }
            50% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.6vh, 0.4vh); }
            60% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(0.3vh, -0.6vh); }
            70% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.4vh, 0.3vh); }
            80% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(0.6vh, -0.5vh); }
            90% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.3vh, 0.5vh); }
        }
        
        @keyframes nervousShakeComingSoon {
            0%, 100% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(0, 0); }
            10% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.5vh, 0.3vh); }
            20% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(0.6vh, -0.4vh); }
            30% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.4vh, 0.6vh); }
            40% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(0.5vh, -0.3vh); }
            50% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.6vh, 0.4vh); }
            60% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(0.3vh, -0.6vh); }
            70% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.4vh, 0.3vh); }
            80% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(0.6vh, -0.5vh); }
            90% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.3vh, 0.5vh); }
        }
        
        canvas.nervous-active {
            animation: nervousShake 0.1s infinite linear;
        }
        
        /* When both Nervous and Long Ago are active */
        canvas.nervous-active.longago-mode {
            animation: nervousShakeLongAgo 0.1s infinite linear;
        }
        
        /* When both Nervous and Coming Soon are active */
        canvas.nervous-active.comingsoon-mode {
            animation: nervousShakeComingSoon 0.1s infinite linear;
        }
        
        /* When both Nervous and Thinner are active */
        @keyframes nervousShakeThinner {
            0%, 100% { transform: scaleX(0.6) translateX(0); }
            25% { transform: scaleX(0.6) translateX(-0.3vh); }
            75% { transform: scaleX(0.6) translateX(0.3vh); }
        }
        
        canvas.nervous-active.thinner-mode {
            animation: nervousShakeThinner 0.1s infinite linear;
        }
        
        /* When both Nervous and Thicker are active */
        @keyframes nervousShakeThicker {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-0.3vh); }
            75% { transform: translateX(0.3vh); }
        }
        
        canvas.nervous-active.thicker-mode {
            animation: nervousShakeThicker 0.1s infinite linear;
        }
        
        /* Three-way combinations: Nervous + Thinner + Long Ago */
        @keyframes nervousShakeThinnerLongAgo {
            0%, 100% { transform: perspective(650px) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%) translateX(0); }
            25% { transform: perspective(650px) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%) translateX(-0.3vh); }
            75% { transform: perspective(650px) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%) translateX(0.3vh); }
        }
        
        canvas.nervous-active.thinner-mode.longago-mode {
            animation: nervousShakeThinnerLongAgo 0.1s infinite linear;
        }
        
        /* Three-way combinations: Nervous + Thinner + Coming Soon */
        @keyframes nervousShakeThinnerComingSoon {
            0%, 100% { transform: perspective(650px) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%) translateX(0); }
            25% { transform: perspective(650px) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%) translateX(-0.3vh); }
            75% { transform: perspective(650px) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%) translateX(0.3vh); }
        }
        
        canvas.nervous-active.thinner-mode.comingsoon-mode {
            animation: nervousShakeThinnerComingSoon 0.1s infinite linear;
        }
        
        /* Three-way combinations: Nervous + Thicker + Long Ago */
        @keyframes nervousShakeThickerLongAgo {
            0%, 100% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translateX(0); }
            25% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translateX(-0.3vh); }
            75% { transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%) translateX(0.3vh); }
        }
        
        canvas.nervous-active.thicker-mode.longago-mode {
            animation: nervousShakeThickerLongAgo 0.1s infinite linear;
        }
        
        /* Three-way combinations: Nervous + Thicker + Coming Soon */
        @keyframes nervousShakeThickerComingSoon {
            0%, 100% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translateX(0); }
            25% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translateX(-0.3vh); }
            75% { transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%) translateX(0.3vh); }
        }
        
        canvas.nervous-active.thicker-mode.comingsoon-mode {
            animation: nervousShakeThickerComingSoon 0.1s infinite linear;
        }
        
        .side-panel {
            background: linear-gradient(180deg, rgba(26, 26, 46, 0.74) 0%, rgba(22, 33, 62, 0.74) 100%);
            padding: 1.8vh 1.5vw;
            border-radius: 0.8vh;
            border: 1px solid rgba(255, 255, 255, 0.08);
            color: #e0e0e0;
            width: 23vw;
            min-width: 220px;
            max-width: 28vw;
            display: flex;
            flex-direction: column;
            height: auto;
            box-sizing: border-box;
            font-size: 1.5vh;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            position: relative;
            flex-shrink: 1;
            flex-grow: 0;
            transition: right 0.3s ease, width 0.3s ease;
            overflow: visible;
        }
        
        /* Responsive adjustments for smaller screens */
        @media (max-width: 1400px) {
            .rules-panel, .side-panel {
                width: 20vw;
                min-width: 180px;
            }
            .game-container {
                gap: 1vw;
            }
        }
        
        @media (max-width: 1200px) {
            .rules-panel, .side-panel {
                width: 18vw;
                min-width: 150px;
                font-size: 12px;
            }
            .game-container {
                gap: 0.5vw;
            }
        }
        
        /* Tablet mode - 50% wider panels */
        body.tablet-mode .rules-panel,
        body.tablet-mode .side-panel {
            width: 33vw;
            min-width: 280px;
            max-width: 40vw;
            overflow: visible;
        }
        
        /* Ensure touch controls fit within panel in tablet mode */
        body.tablet-mode #touchControls {
            margin-top: 0.5vh;
            max-height: 20vh;
        }
        
        body.tablet-mode .touch-btn {
            min-height: 4.5vh;
            max-height: 6vh;
        }
        
        /* Minimalist mode styles */
        body.minimalist-mode .rules-panel {
            background: transparent !important;
            box-shadow: none !important;
        }
        
        body.minimalist-mode .rules-instructions {
            display: none !important;
        }
        
        body.minimalist-mode .side-panel {
            background: transparent !important;
            box-shadow: none !important;
        }
        
        body.minimalist-mode .side-panel > *:not(.score-display:first-child):not(.next-piece) {
            visibility: hidden !important;
        }
        
        body.minimalist-mode .side-panel .score-display:first-child {
            visibility: hidden !important;
        }
        
        body.minimalist-mode.game-started .side-panel .score-display:first-child {
            visibility: visible !important;
        }
        
        body.minimalist-mode .side-panel .score-display:first-child .score-label {
            display: none !important;
        }
        
        body.minimalist-mode .side-panel .score-display:first-child #score {
            font-size: 3vh !important;
        }
        
        body.minimalist-mode .next-piece .score-label {
            visibility: hidden !important;
        }
        
        body.minimalist-mode .next-canvas {
            background: transparent !important;
            box-shadow: none !important;
        }
        
        
        /* Global custom scrollbar styling */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        ::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 4px;
        }
        ::-webkit-scrollbar-thumb {
            background: rgba(255, 215, 0, 0.3);
            border-radius: 4px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 215, 0, 0.5);
        }
        
        .rules-panel {
            background: linear-gradient(180deg, rgba(26, 26, 46, 0.74) 0%, rgba(22, 33, 62, 0.74) 100%);
            padding: 1.6vh 1vw;
            border-radius: 0.8vh;
            border: 1px solid rgba(255, 255, 255, 0.08);
            color: #e0e0e0;
            width: 23vw;
            min-width: 220px;
            max-width: 28vw;
            height: auto;
            box-sizing: border-box;
            overflow: hidden;
            font-size: 1.4vh;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            display: flex;
            flex-direction: column;
            gap: 0.7vh;
            position: relative;
            z-index: 5;
            flex-shrink: 1;
            flex-grow: 0;
            transition: left 0.3s ease, width 0.3s ease;
        }
        
        .rules-instructions {
            display: block;
            overflow-y: auto;
            flex-shrink: 1;
            max-height: 100%;
            color: #ccc;
            line-height: 1.5;
        }
        
        .rules-instructions strong {
            color: #fff;
        }
        
        /* When histogram is visible, limit instructions height */
        .rules-panel:has(.histogram-canvas[style*="display: block"]) .rules-instructions {
            max-height: 0;
            overflow: hidden;
            padding: 0;
            margin: 0;
        }
        .histogram-canvas {
            width: 100%;
            flex: 1; /* Take available space */
            min-height: 30vh; /* Ensure minimum height for histograms */
            display: none; /* Hidden by default, shown during gameplay */
            border: none; /* Remove any border */
            box-shadow: none; /* Remove drop shadow */
            background: transparent; /* Explicit transparent background */
        }
        
        /* Touch Controls for Tablet Mode */
        #touchControls {
            display: none; /* Hidden by default, shown in tablet mode */
            grid-template-columns: repeat(6, 1fr); /* 6 columns for easy 50/50 bottom split */
            grid-template-rows: auto auto auto;
            column-gap: 0.5vh; /* Horizontal gap between buttons */
            row-gap: 0.5vh; /* Match vertical gap to horizontal */
            padding: 0.5vh;
            margin-top: 1vh;
            height: auto;
            max-height: 22vh;
        }
        
        .touch-btn {
            background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 100%);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 8px;
            color: #e0e0e0;
            font-size: 3.2vh;
            font-weight: 600;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
            transition: all 0.1s;
            padding: 0;
            min-height: 5vh;
            max-height: 6.5vh;
        }
        
        .touch-btn:active {
            background: linear-gradient(180deg, #3d5a80 0%, #2d4a70 100%);
            border-color: #6eb5ff;
            transform: scale(0.96);
        }
        
        /* Row 1: Single ROTATE CCW button spanning all 6 columns */
        .touch-btn.touch-btn-rotate-ccw {
            grid-column: 1 / 7;
            grid-row: 1 / 2;
        }
        
        /* Row 2: Three buttons, each spanning 2 columns (2+2+2 = 6) */
        .touch-btn.touch-btn-left {
            grid-column: 1 / 3;
            grid-row: 2 / 3;
        }
        
        .touch-btn.touch-btn-rotate {
            grid-column: 3 / 5;
            grid-row: 2 / 3;
        }
        
        .touch-btn.touch-btn-right {
            grid-column: 5 / 7;
            grid-row: 2 / 3;
        }
        
        /* Row 3: Two buttons, each spanning 3 columns (3+3 = 6, perfect 50/50 split) */
        .touch-btn.touch-btn-down {
            grid-column: 1 / 4;
            grid-row: 3 / 4;
        }
        
        .touch-btn.touch-btn-drop {
            grid-column: 4 / 7;
            grid-row: 3 / 4;
        }
        
        /* Pause Button (top-right corner during tablet mode gameplay) */
        .pause-btn {
            display: none; /* Hidden by default */
            position: absolute;
            top: 1vh;
            right: 1.5vw;
            padding: 1vh 1.5vw;
            font-size: 2.5vh;
            background: rgba(30, 60, 120, 0.9);
            color: white;
            border: 0.3vh solid rgba(255, 255, 255, 0.6);
            border-radius: 0.8vh;
            cursor: pointer;
            transition: all 0.1s;
            z-index: 9999;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }
        
        .pause-btn:hover {
            background: rgba(50, 100, 180, 1);
            border-color: #FFD700;
        }
        
        .pause-btn:active {
            transform: scale(0.95);
        }
        
        /* Planet Stats in Left Panel (Tablet Mode) */
        #planetStatsLeft {
            display: none; /* Hidden by default, shown in tablet mode */
            margin-top: 0;
            padding: 0.7vh 0.6vw;
            background: rgba(26, 26, 46, 0.8);
            border-radius: 0.5vh;
            border: 1px solid rgba(255, 255, 255, 0.1);
            font-size: 1vh;
            color: #ccc;
            max-height: 12vh;
            overflow-y: auto;
            flex-shrink: 0;
        }
        
        #planetStatsLeftContent {
            font-size: 1vh;
            line-height: 1.2;
        }
        
        .rules-title {
            font-size: 2vh;
            font-weight: 600;
            margin-bottom: 0.4vh;
            text-align: center;
            color: #fff;
        }
        .rules-section {
            margin-bottom: 10px;
            font-size: clamp(10.56px, 1.37vh, 14.78px);
            line-height: 1.3;
        }
        .rules-section h3 {
            font-size: clamp(12.67px, 1.58vh, 16.9px);
            margin-bottom: 6px;
            color: #6eb5ff;
        }
        .rules-section ul {
            margin: 4px 0;
            padding-left: 15px;
        }
        .rules-section li {
            margin-bottom: 3px;
        }
		.rules-section div {
			padding: 0 0 12px;
		}
        .tsunami-scoring {
            display: inline-block;
            margin-top: 0.5em;
            margin-bottom: 0.5em;
        }
        .score-display {
            font-size: 2.6vh;
            margin-bottom: 0.6vh;
            color: #fff;
        }
        .score-display > div:not(.score-label) {
            text-align: center;
        }
        .score-label {
            font-size: 1.3vh;
            color: #aaa;
            text-transform: uppercase;
            letter-spacing: 0.05vh;
            text-align: left;
        }
        
        /* Special Events Grid - 2 columns */
        .special-events-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            column-gap: 1vw;
            row-gap: 0.8vh;
            margin-top: 1.8vh;
        }
        .special-events-grid .score-display {
            margin-bottom: 0;
            font-size: 2.2vh;
        }
        
        /* Gold glow for special event triggers */
        @keyframes goldPulse {
            0% { color: #FFD700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.4); }
            50% { color: #FFF2B0; text-shadow: 0 0 15px rgba(255, 215, 0, 1), 0 0 35px rgba(255, 215, 0, 0.6), 0 0 50px rgba(255, 180, 0, 0.3); }
            100% { color: #FFD700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.8), 0 0 20px rgba(255, 215, 0, 0.4); }
        }
        @keyframes goldFade {
            0% { color: #FFF2B0; text-shadow: 0 0 15px rgba(255, 215, 0, 1), 0 0 35px rgba(255, 215, 0, 0.6); }
            100% { color: #fff; text-shadow: none; }
        }
        @keyframes labelGoldFade {
            0% { color: #FFD700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.6); }
            100% { color: #aaa; text-shadow: none; }
        }
        .score-display.gold-glow .score-label {
            animation: goldPulse 0.6s ease-in-out 2, labelGoldFade 1.2s ease-out 1.2s forwards;
            color: #FFD700;
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
        }
        .score-display.gold-glow > div:last-child {
            animation: goldPulse 0.6s ease-in-out 2, goldFade 1.2s ease-out 1.2s forwards;
            color: #FFD700;
            text-shadow: 0 0 15px rgba(255, 215, 0, 1), 0 0 35px rgba(255, 215, 0, 0.6);
        }
        
        .next-piece {
            margin-top: 0.4vh;
            margin-bottom: 0.4vh;
            flex-shrink: 0;
            overflow: visible;
            position: relative;
            z-index: 100;
        }
        .next-piece .score-label {
            text-align: left;
        }
        .next-canvas-wrapper {
            width: min(180px, 12vw);
            height: min(180px, 22vh);
            border-radius: 0.5vh;
            margin-top: 2.6vh;
            margin-bottom: 0.4vh;
            position: relative;
            overflow: visible;
        }
        .next-canvas {
            position: absolute;
            bottom: 0;
            left: 0;
            z-index: 100;
            border: none;
            background: transparent;
            box-shadow: none;
            max-height: none;
            /* Crisp pixel rendering to prevent lines in fullscreen */
            image-rendering: -moz-crisp-edges;
            image-rendering: -webkit-crisp-edges;
            image-rendering: pixelated;
            image-rendering: crisp-edges;
        }
        .controls {
            font-size: 1.3vh;
            line-height: 1.6;
            flex-grow: 0;
            flex-shrink: 0;
            overflow-y: auto;
            transition: opacity 0.3s ease-in-out;
            color: #ccc;
        }
        
        /* Bottom section wrapper - pushes planet stats and music to bottom */
        .side-panel-bottom {
            margin-top: auto;
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            flex-grow: 0;
            justify-content: flex-end;
        }
        .controls > div:not(.controls-title) {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1ch;
        }
        .controls .control-key {
            text-align: right;
            color: #aaa;
        }
        .controls > div:not(.controls-title) > span:last-child {
            text-align: left;
        }
        .controls-title {
            margin-bottom: 0.5vh;
            text-align: left;
            color: #fff;
            font-weight: 600;
        }
        button {
            margin-top: 20px;
            padding: 10px 24px;
            font-size: 14px;
            font-weight: 500;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background: #3d7dd4;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.2s;
        }
        button:hover {
            background: #4a8de4;
        }
        .game-over {
            position: fixed;
            top: 12%;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, rgba(26, 26, 46, 0.66) 0%, rgba(22, 33, 62, 0.66) 100%);
            color: #e0e0e0;
            padding: 20px 36px;
            border-radius: 8px;
            text-align: center;
            font-size: 18px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            display: none;
            min-width: 200px;
            z-index: 1001;
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }
        
        .gameover-share-row {
            display: flex;
            justify-content: center;
            gap: 12px;
            margin-top: 16px;
            margin-bottom: 6px;
        }
        
        .gameover-share-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.1);
            cursor: pointer;
            transition: all 0.2s ease;
            text-decoration: none;
        }
        
        .gameover-share-icon:hover {
            background: rgba(255, 255, 255, 0.15);
            border-color: rgba(255, 255, 255, 0.25);
            transform: scale(1.1);
        }
        
        .gameover-share-icon svg {
            width: 16px;
            height: 16px;
            fill: rgba(255, 255, 255, 0.5);
            transition: fill 0.2s ease;
        }
        
        .gameover-share-icon:hover svg {
            fill: rgba(255, 255, 255, 0.85);
        }
        
        /* End Credits Overlay */
        .credits-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.85);
            display: none;
            overflow: hidden;
            z-index: 998;
            font-family: 'Futura', 'Arial', 'Century Gothic', 'Trebuchet MS', sans-serif;
        }
        
        .credits-scroll {
			display: flex;
			justify-content: center;
            position: absolute;
            width: 100%;
            color: white;
        }
        
        .credits-content {
            padding: 20px;
            text-align: center;
			max-width: 34%;
        }
        
        .credits-title {
            font-size: 28px;
            font-weight: bold;
            margin-bottom: 60px;
            color: #FFD700;
        }
		
		.credits-ai {
			color: #FFFAAA;
		}
        
        .credits-section {
            margin-bottom: 40px;
        }
        
        .credits-row {
            display: flex;
            justify-content: center;
            gap: 40px;
            margin-bottom: 8px;
            font-size: 18px;
        }
        
        .credits-role {
            width: 420px;
            text-align: left;
            color: #aaa;
			padding-left: 50px;
        }
        
        .credits-name {
            width: 230px;
            text-align: left;
            color: #fff;
        }
        
        .credits-thanks {
            font-size: 18px;
            color: #FFD700;
            margin: 60px 0;
        }
        
        .credits-disclaimer {
            font-size: 16px;
            color: #aaa;
            margin: 15px 0;
        }
		
		.credits-disclaimer p {
            text-align: left;
			text-indent: 2em;
			margin: 0;
		}
        
        .credits-copyright {
            font-size: 18px;
            color: #aaa;
            margin-top: 60px;
        }
        
        .credits-link {
            font-size: 16px;
            color: #4da6ff;
            margin-top: 15px;
        }
        
        .credits-easter {
            font-size: 1.88vh;
            color: #666;
            font-style: italic;
        }
        
        .soundtrack-section {
            margin: 50px auto;
            padding: 30px 40px;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        }
        
        .soundtrack-heading {
            font-size: 15px;
            color: #888;
            text-transform: uppercase;
            letter-spacing: 3px;
            margin-bottom: 12px;
        }
        
        .soundtrack-title {
            font-size: 20px;
            color: #FFD700;
            margin-bottom: 20px;
            font-weight: 600;
        }
        
        .soundtrack-links {
            display: flex;
            justify-content: center;
            gap: 30px;
            align-items: center;
        }
        
        .soundtrack-link {
            display: flex;
            align-items: center;
            gap: 10px;
            text-decoration: none;
            color: #ccc;
            font-size: 14px;
            padding: 8px 18px;
            border-radius: 24px;
            border: 1px solid rgba(255, 255, 255, 0.12);
            transition: all 0.25s ease;
            background: rgba(255, 255, 255, 0.03);
        }
        
        .soundtrack-link:hover {
            border-color: rgba(255, 255, 255, 0.3);
            background: rgba(255, 255, 255, 0.08);
            color: #fff;
        }
        
        .soundtrack-link svg {
            width: 22px;
            height: 22px;
            flex-shrink: 0;
        }
        
        .credits-spacer {
            height: 24vh;
        }
        
        .credits-spacer-large {
            height: 42vh;
        }
        
        .credits-spacer-final {
            height: 100vh;
        }
		
        .start-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgb(0, 0, 0);
            z-index: 2000;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 20px;
            padding-bottom: max(8vh, 40px);
            box-sizing: border-box;
        }
        .intro-title.well-title {
            font-size: max(5.5vh, 28px);
            margin-bottom: 0;
        }
        
        @keyframes introThrob {
            0%, 100% { 
                opacity: 0.7; 
                transform: scale(1);
                filter: drop-shadow(0 0.2vh 0.4vh rgba(255, 215, 0, 0.5))
                        drop-shadow(0 0.4vh 0.8vh rgba(0, 0, 0, 0.7));
            }
            50% { 
                opacity: 1; 
                transform: scale(1.05);
                filter: drop-shadow(0 0.3vh 0.6vh rgba(255, 215, 0, 0.8))
                        drop-shadow(0 0.4vh 0.8vh rgba(0, 0, 0, 0.7));
            }
        }
        
        /* Intro screen controls */
        .intro-controls {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0;
            margin-top: 20px;
        }
        .intro-toggle {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-top: max(1vh, 6px);
            background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 100%);
            padding: 12px 20px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            width: 320px;
            justify-content: space-between;
            cursor: pointer;
            transition: all 0.15s;
            box-sizing: border-box;
            overflow: hidden;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        .intro-toggle:hover {
            background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
            border-color: rgba(110, 181, 255, 0.3);
        }
        .intro-toggle-label {
            color: #ccc;
            font-size: 14px;
            font-weight: 500;
            white-space: nowrap;
        }
        .intro-toggle .toggle-switch {
            flex-shrink: 0;
        }
        .intro-toggle select {
            flex: 1;
            max-width: 160px;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .start-game-btn {
            margin-top: 20px;
            padding: 16px 44px;
            font-size: 18px;
            font-weight: 600;
            white-space: nowrap;
            background: linear-gradient(180deg, #5a9ae8 0%, #2d5fb8 100%);
            color: #fff;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.15s;
            box-shadow: 0 4px 20px rgba(61, 125, 212, 0.3);
            text-transform: uppercase;
            letter-spacing: 1px;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            width: 320px;
            box-sizing: border-box;
        }
        .start-game-btn:hover {
            background: linear-gradient(180deg, #6aaaf0 0%, #3d6fc8 100%);
            transform: translateY(-1px);
            box-shadow: 0 6px 25px rgba(61, 125, 212, 0.4);
        }
        .start-game-btn:active {
            transform: translateY(0);
        }
        .intro-dropdown-wrapper {
            width: 320px;
            margin-top: max(0.3vh, 2px);
        }
        .intro-dropdown-wrapper:first-child {
            margin-top: 0;
        }
        .intro-dropdowns-row {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            width: 320px;
        }
        .intro-dropdowns-row .intro-dropdown-wrapper {
            width: 100%;
        }
        .intro-controls > .intro-toggle:first-of-type {
            margin-top: max(1.8vh, 12px);
        }
        .intro-toggles-row {
            display: flex;
            align-items: stretch;
            gap: max(0.5vw, 4px);
            width: 320px;
            margin-top: max(2.2vh, 14px);
            margin-bottom: max(0.5vh, 4px);
        }
        .intro-toggles-row .intro-toggle {
            flex: 1;
            width: auto;
            margin-top: 0;
            padding: 8px 10px;
        }
        .login-btn {
            position: absolute;
            top: 20px;
            right: 20px;
            padding: 10px 18px;
            font-size: 13px;
            font-weight: 500;
            background: #2a2a3a;
            color: #ccc;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.15s;
            z-index: 10;
            pointer-events: auto;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        .login-btn:hover {
            background: #3a3a4a;
            border-color: rgba(110, 181, 255, 0.3);
            color: #fff;
        }
        .login-btn.hidden {
            display: none;
        }
        
        /* Login Modal Styles */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            z-index: 10000;
            display: none;
            justify-content: center;
            align-items: center;
        }
        .modal-overlay.active {
            display: flex;
        }
        .auth-modal {
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            padding: 28px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #e0e0e0;
            min-width: 280px;
            max-width: 400px;
            position: relative;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        .auth-modal h2 {
            text-align: center;
            margin-bottom: 20px;
            font-size: 22px;
            font-weight: 600;
            color: #6eb5ff;
        }
        .modal-close {
            position: absolute;
            top: 10px;
            right: 15px;
            background: none;
            border: none;
            color: #888;
            font-size: 28px;
            cursor: pointer;
            opacity: 0.7;
        }
        .modal-close:hover {
            opacity: 1;
            color: #fff;
        }
        .auth-modal .form-group {
            margin-bottom: 15px;
        }
        .auth-modal label {
            display: block;
            margin-bottom: 6px;
            font-size: 11px;
            color: #888;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .auth-modal input[type="text"],
        .auth-modal input[type="email"],
        .auth-modal input[type="password"] {
            width: 100%;
            padding: 12px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            background: #2a2a3a;
            color: #e0e0e0;
            font-size: 14px;
            box-sizing: border-box;
            font-family: inherit;
        }
        .auth-modal input:focus {
            outline: none;
            border-color: #6eb5ff;
            box-shadow: 0 0 0 3px rgba(110, 181, 255, 0.15);
        }
        .auth-submit-btn {
            width: 100%;
            padding: 12px;
            font-size: 14px;
            font-weight: 500;
            background: #3d7dd4;
            color: #fff;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            letter-spacing: 0.5px;
            font-family: inherit;
            transition: background 0.15s;
        }
        .auth-submit-btn:hover {
            background: #4a8de4;
        }
        .auth-divider {
            text-align: center;
            margin: 20px 0;
            color: #666;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .oauth-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            width: 100%;
            padding: 12px;
            background: #fff;
            color: #333;
            border: none;
            border-radius: 6px;
            font-size: 13px;
            font-weight: 500;
            text-decoration: none;
            cursor: pointer;
            font-family: inherit;
            transition: background 0.15s;
        }
        .oauth-btn:hover {
            background: #f5f5f5;
        }
        .auth-footer {
            text-align: center;
            margin-top: 20px;
            font-size: 13px;
            color: #888;
        }
        .auth-footer a {
            color: #6eb5ff;
            text-decoration: none;
            margin-left: 5px;
        }
        .auth-footer a:hover {
            text-decoration: underline;
        }
        .error-message {
            background: rgba(255, 100, 100, 0.2);
            border: 1px solid rgba(255, 100, 100, 0.5);
            color: #ff6b6b;
            padding: 10px;
            border-radius: 6px;
            margin-bottom: 15px;
            font-size: 14px;
            display: none;
        }
        
        .settings-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 1000;
            display: none;
            justify-content: center;
            align-items: center;
            padding: 2vh 2vw;
            box-sizing: border-box;
        }
        .settings-popup {
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            padding: 1vh 1.8vw;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #e0e0e0;
            min-width: 30vw;
            max-width: 90vw;
            max-height: 92vh;
            overflow-y: auto;
            overflow-x: hidden;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            font-size: 14px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        .settings-columns {
            display: flex;
            gap: 1.5vw;
        }
        .settings-column-left {
            flex: 1;
            min-width: 240px;
        }
        .settings-column-right {
            flex: 0 0 auto;
            min-width: 160px;
            max-width: 220px;
            border-left: 1px solid rgba(255, 255, 255, 0.08);
            padding-left: 1.5vw;
        }
        @media (max-width: 800px) {
            .settings-columns {
                flex-direction: column;
            }
            .settings-column-right {
                border-left: none;
                border-top: 1px solid rgba(255, 255, 255, 0.08);
                padding-left: 0;
                padding-top: 1.5vh;
                margin-top: 1vh;
                max-width: none;
            }
        }
        .settings-title {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 0.8vh;
            text-align: center;
            color: #fff;
            letter-spacing: 0.5px;
        }
        .settings-popup button:not(.settings-close-btn) {
            margin-top: 0;
        }
        .settings-option {
            margin-bottom: 0.15vh;
            padding: 0.55vh 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        }
        .settings-option:last-child {
            border-bottom: none;
        }
        .settings-option label {
            cursor: pointer;
            display: flex;
            align-items: center;
            font-size: 14px;
            color: #ccc;
        }
        .settings-option label:hover {
            color: #fff;
        }
        .settings-option input[type="checkbox"] {
            width: 2vh;
            height: 2vh;
            margin-right: 1.2vw;
            cursor: pointer;
            display: none;
        }
        
        /* Toggle Switch - cleaner style */
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 36px;
            height: 20px;
            margin-right: 12px;
            flex-shrink: 0;
        }
        
        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        
        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #3a3a4a;
            transition: all 0.2s ease;
            border-radius: 10px;
        }
        
        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 14px;
            width: 14px;
            left: 3px;
            bottom: 3px;
            background-color: #888;
            transition: all 0.2s ease;
            border-radius: 50%;
        }
        
        input:checked + .toggle-slider {
            background-color: #3d7dd4;
        }
        
        input:checked + .toggle-slider:before {
            transform: translateX(16px);
            background-color: #fff;
        }
        
        .toggle-slider:hover {
            background-color: #4a4a5a;
        }
        
        input:checked + .toggle-slider:hover {
            background-color: #4a8de4;
        }
        
        /* Label adjustment for toggle switches */
        .settings-option label.toggle-label,
        .settings-option div.toggle-label {
            cursor: pointer;
            display: flex;
            align-items: center;
            font-size: 14px;
            justify-content: space-between;
        }
        
        .toggle-label-text {
            flex-grow: 1;
            display: flex;
            align-items: center;
        }
        .label-short {
            display: none;
        }
        .settings-option input[type="range"] {
            -webkit-appearance: none;
            appearance: none;
            height: 4px;
            background: #3a3a4a;
            border-radius: 2px;
            outline: none;
        }
        .settings-option input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 16px;
            height: 16px;
            background: #3d7dd4;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid #fff;
        }
        .settings-option input[type="range"]::-moz-range-thumb {
            width: 16px;
            height: 16px;
            background: #3d7dd4;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid #fff;
        }
        .settings-close-btn {
            width: 100%;
            margin-top: 1.2vh;
            padding: 8px 16px;
            font-size: 14px;
            background: #3d7dd4;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.2s;
            font-weight: 500;
        }
        .settings-close-btn:hover {
            background: #4a8de4;
        }
        
        /* Settings description text */
        .settings-description {
            font-size: 11px;
            color: #888;
            margin-top: 4px;
            margin-left: 48px;
        }
        
        /* Challenge dropdown styles */
        .settings-option select {
            width: 100%;
            padding: 8px 10px;
            font-size: 14px;
            background: #2a2a3a;
            color: #e0e0e0;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            cursor: pointer;
            margin-top: 0;
        }
        .settings-option select:hover {
            border-color: rgba(255, 255, 255, 0.2);
        }
        .settings-option select option {
            background: #2a2a3a;
            color: #e0e0e0;
        }
        
        /* Responsive adjustments for small screens */
        @media (max-height: 850px) {
            .settings-popup {
                padding: 1vh 1.5vw;
            }
            .settings-title {
                font-size: 17px;
                margin-bottom: 0.5vh;
            }
            .settings-option {
                margin-bottom: 0;
                padding: 0.8vh 0;
            }
            .settings-desc {
                display: none; /* Hide descriptions earlier */
            }
            .settings-divider {
                margin: 2.5vh 0;
            }
            .settings-close-btn {
                margin-top: 0.5vh;
                padding: 6px 14px;
            }
        }
        @media (max-height: 700px) {
            .settings-popup {
                padding: 0.8vh 1.5vw;
                font-size: 12px;
            }
            .settings-title {
                font-size: 16px;
                margin-bottom: 0.4vh;
            }
            .settings-option {
                margin-bottom: 0;
                padding: 0.8vh 0;
            }
            .settings-close-btn {
                padding: 5px 12px;
                font-size: 12px;
                margin-top: 0.4vh;
            }
            .controls-config-title {
                margin-bottom: 4px;
            }
            .settings-divider {
                margin: 2.5vh 0;
            }
            .palette-dropdown-button {
                padding: 5px 8px;
            }
        }
        @media (max-height: 600px), (max-width: 600px) {
            .settings-popup {
                padding: 0.6vh 1.2vw;
                font-size: 11px;
                min-width: 50vw;
            }
            .settings-title {
                font-size: 14px;
                margin-bottom: 0.3vh;
            }
            .settings-option {
                margin-bottom: 0;
                padding: 0.8vh 0;
            }
            .settings-option label {
                font-size: 11px;
            }
            .settings-close-btn {
                padding: 4px 10px;
                font-size: 11px;
                margin-top: 0.3vh;
            }
            .toggle-switch {
                transform: scale(0.85);
            }
            .settings-divider {
                margin: 2.5vh 0;
            }
            .palette-dropdown-button {
                padding: 4px 6px;
            }
        }
        
        /* Ensure scrollbar is styled on the settings popup */
        .settings-popup::-webkit-scrollbar {
            width: 6px;
        }
        .settings-popup::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 3px;
        }
        .settings-popup::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
        }
        .settings-popup::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.5);
        }
        
        /* Controls Configuration */
        .controls-config-section {
            padding-top: 0;
        }
        .controls-config-title {
            font-size: 14px;
            font-weight: 600;
            margin-bottom: 8px;
            color: #6eb5ff;
        }
        .controls-section {
            margin-bottom: 8px;
        }
        .controls-section-title {
            font-size: 11px;
            font-weight: 600;
            margin-bottom: 5px;
            color: #888;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .control-binding-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 4px;
            padding: 2px 0;
        }
        .control-action-name {
            font-size: 12px;
            color: #aaa;
        }
        .control-binding-btn {
            background: #2a2a3a;
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #e0e0e0;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 11px;
            min-width: 65px;
            cursor: pointer;
            transition: all 0.15s ease;
            font-family: inherit;
        }
        .control-binding-btn:hover {
            background: #3a3a4a;
            border-color: #6eb5ff;
            color: #fff;
        }
        .control-binding-btn.capturing {
            background: rgba(110, 181, 255, 0.2);
            border-color: #6eb5ff;
            animation: pulse-capture 0.8s ease-in-out infinite;
        }
        @keyframes pulse-capture {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.6; }
        }
        .controls-reset-btn {
            width: 100%;
            padding: 6px;
            margin-top: 10px;
            background: transparent;
            border: 1px solid rgba(255, 255, 255, 0.15);
            color: #888;
            border-radius: 4px;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.15s ease;
            font-family: inherit;
        }
        .controls-reset-btn:hover {
            background: rgba(255, 100, 100, 0.1);
            border-color: rgba(255, 100, 100, 0.4);
            color: #ff8080;
        }
        
        /* Combo challenge modal */
        .combo-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            z-index: 2000;
            display: none;
            justify-content: center;
            align-items: center;
        }
        .combo-modal {
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            padding: 20px 28px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #e0e0e0;
            min-width: 40vw;
            max-width: 90vw;
            max-height: 82vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        .combo-modal-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 12px;
            text-align: center;
            color: #6eb5ff;
        }
        .combo-bonus-display {
            text-align: center;
            font-size: 14px;
            font-weight: 500;
            color: #6eb5ff;
            background: rgba(110, 181, 255, 0.1);
            padding: 8px;
            border-radius: 6px;
            margin-bottom: 12px;
            border: 1px solid rgba(110, 181, 255, 0.2);
        }
        .combo-bonus-display span {
            color: #fff;
            font-size: 16px;
        }
        .combo-checkboxes-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 6px 16px;
            margin-bottom: 0;
        }
        .combo-checkbox-option {
            margin: 0;
            padding: 8px 12px;
            background: transparent;
            border-radius: 6px;
            border: 1px solid transparent;
            transition: all 0.15s;
            cursor: pointer;
        }
        .combo-checkbox-option:hover {
            border-color: rgba(110, 181, 255, 0.3);
            background: rgba(110, 181, 255, 0.05);
        }
        .combo-checkbox-option.checked {
            border-color: rgba(110, 181, 255, 0.6);
            background: rgba(110, 181, 255, 0.15);
        }
        .combo-checkbox-option.checked:hover {
            border-color: rgba(110, 181, 255, 0.7);
            background: rgba(110, 181, 255, 0.2);
        }
        .combo-checkbox-option label {
            cursor: pointer;
            display: flex;
            align-items: center;
            font-size: 13px;
            color: #ccc;
        }
        .combo-checkbox-option input[type="checkbox"] {
            display: none;
        }
        .combo-checkbox-option .toggle-switch {
            position: relative;
            display: inline-block;
            width: 28px;
            height: 16px;
            margin-right: 10px;
            flex-shrink: 0;
        }
        .combo-checkbox-option .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #3a3a4a;
            transition: all 0.2s ease;
            border-radius: 8px;
        }
        .combo-checkbox-option .toggle-slider:before {
            position: absolute;
            content: "";
            height: 12px;
            width: 12px;
            left: 2px;
            bottom: 2px;
            background-color: #888;
            transition: all 0.2s ease;
            border-radius: 50%;
        }
        .combo-checkbox-option input:checked + .toggle-slider {
            background-color: #3d7dd4;
        }
        .combo-checkbox-option input:checked + .toggle-slider:before {
            transform: translateX(12px);
            background-color: #fff;
        }
        .combo-checkbox-option .challenge-description {
            font-size: 11px;
            color: #888;
            margin-top: 4px;
            margin-left: 38px;
        }
        .combo-modal-buttons {
            display: flex;
            gap: 12px;
            margin-top: 0;
            position: sticky;
            bottom: 0;
            padding-top: 0;
        }
        .combo-modal-btn {
            flex: 1;
            padding: 10px 20px;
            font-size: 14px;
            font-weight: 500;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.15s;
            font-family: inherit;
        }
        .combo-modal-btn.apply {
            background: #3d7dd4;
            color: white;
        }
        .combo-modal-btn.apply:hover {
            background: #4a8de4;
        }
        .combo-modal-btn.cancel {
            background: #3a3a4a;
            color: #ccc;
        }
        .combo-modal-btn.cancel:hover {
            background: #4a4a5a;
            color: #fff;
        }

        /* Selection modals (Skill Level & Difficulty) */
        .selection-modal {
            min-width: min(420px, 85vw);
            max-width: min(480px, 90vw);
        }
        .selection-options-list {
            display: flex;
            flex-direction: column;
            gap: max(0.6vh, 4px);
        }
        .selection-option {
            padding: max(1.2vh, 10px) max(1.5vw, 14px);
            background: transparent;
            border-radius: max(0.6vh, 5px);
            border: 1px solid rgba(255, 255, 255, 0.08);
            cursor: pointer;
            transition: all 0.15s;
        }
        .selection-option:hover {
            border-color: rgba(110, 181, 255, 0.4);
            background: rgba(110, 181, 255, 0.08);
        }
        .selection-option.selected {
            border-color: rgba(110, 181, 255, 0.6);
            background: rgba(110, 181, 255, 0.15);
        }
        .selection-option-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .selection-option-name {
            font-size: max(1.6vh, 14px);
            font-weight: 600;
            color: #e0e0e0;
        }
        .selection-option.selected .selection-option-name {
            color: #6eb5ff;
        }
        .selection-option .challenge-description {
            font-size: max(1.2vh, 11px);
            color: #888;
            margin-top: max(0.4vh, 3px);
            margin-left: 0;
        }
        .selection-option.selected .challenge-description {
            color: #aaa;
        }
        .selection-option-bullets {
            margin: max(0.4vh, 3px) 0 0 0;
            padding-left: max(2vh, 16px);
            list-style: disc;
            font-size: max(1.2vh, 11px);
            color: #888;
            line-height: 1.6;
        }
        .selection-option-bullets li {
            margin: 0;
            padding: 0;
        }
        .selection-option.selected .selection-option-bullets {
            color: #aaa;
        }
        
        /* Upside-down mode */
        html.stranger-mode {
            transform: rotate(180deg);
        }
        
        /* Thinner mode - make canvas narrower */
        canvas.thinner-mode {
            transform: scaleX(0.6);
        }
        
        /* Thicker mode - canvas dimensions handled by JavaScript updateCanvasSize() */
        canvas.thicker-mode {
            /* Dimensions set via style attribute in updateCanvasSize() */
            /* This creates actual layout space unlike transform */
            margin: auto; /* Center the canvas */
        }
        
        /* Allow main area to properly center the thicker canvas */
        body:has(canvas.thicker-mode) .main-area {
            overflow: visible; /* Allow scaled canvas to extend beyond */
            padding: 1vh 0.25vw; /* Reduce side padding */
            z-index: 10; /* Ensure it renders on top */
            justify-content: center; /* Center vertically */
        }
        
        /* Make both side panels symmetric when Thicker mode is active */
        body:has(canvas.thicker-mode) .game-container {
            gap: 2vw; /* Consistent gap with normal mode */
            justify-content: space-between; /* Maintain spacing */
            align-items: center; /* Center main area vertically */
        }
        
        /* Allow perspective transforms to render without clipping */
        body:has(canvas.longago-mode) .main-area,
        body:has(canvas.comingsoon-mode) .main-area {
            overflow: visible;
            flex-grow: 1.8;
        }
        
        body:has(canvas.longago-mode) .game-container,
        body:has(canvas.comingsoon-mode) .game-container {
            overflow: visible;
        }
        
        body:has(canvas.longago-mode) .content-area,
        body:has(canvas.comingsoon-mode) .content-area {
            overflow: visible;
        }
        
        /* Shrink side panels for perspective modes on desktop */
        body:has(canvas.longago-mode) .side-panel,
        body:has(canvas.comingsoon-mode) .side-panel,
        body:has(canvas.longago-mode) .rules-panel,
        body:has(canvas.comingsoon-mode) .rules-panel {
            width: 20vw;
            font-size: 0.96em;
            padding: 1.5vh 1.2vw;
        }
        
        /* Removed thicker-mode panel width adjustments - panels now reposition via JavaScript */
        
        /* Make the instructions text smaller in thicker mode */
        body:has(canvas.thicker-mode) .rules-instructions {
            font-size: 1.3vh;
        }
        
        /* Adjust the controls/stats section */
        body:has(canvas.thicker-mode) .controls {
            font-size: 1.15vh; /* Smaller text */
        }
        
        /* Make stats displays more compact */
        body:has(canvas.thicker-mode) .stat-value {
            font-size: 1.6vh;
        }
        
        /* Adjust score displays in Thicker mode */
        body:has(canvas.thicker-mode) .score-display {
            font-size: 1.4vh;
        }
        
        body:has(canvas.thicker-mode) .score-display > div:not(.score-label) {
            font-size: 1.8vh; /* Smaller score values */
        }
        
        /* Histogram adjustments */
        body:has(canvas.thicker-mode) .histogram-canvas {
            min-height: 25vh; /* Smaller histogram */
        }
        
        /* Long Ago mode - Star Wars opening crawl perspective */
        canvas.longago-mode {
            transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%);
            transform-origin: center center;
            filter: brightness(0.9);
        }
        
        /* Coming Soon mode - Reverse perspective (top wide, bottom narrow) */
        canvas.comingsoon-mode {
            transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%);
            transform-origin: center center;
            filter: brightness(0.9);
        }
        
        /* Combined mode: Thinner + Long Ago */
        canvas.thinner-mode.longago-mode {
            transform: perspective(650px) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%);
            transform-origin: center center;
            filter: brightness(0.9);
        }
        
        /* Combined mode: Thinner + Coming Soon */
        canvas.thinner-mode.comingsoon-mode {
            transform: perspective(650px) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%);
            transform-origin: center center;
            filter: brightness(0.9);
        }
        
        /* Combined mode: Thicker + Long Ago */
        canvas.thicker-mode.longago-mode {
            transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%);
            transform-origin: center center;
            filter: brightness(0.9);
        }
        
        /* Combined mode: Thicker + Coming Soon */
        canvas.thicker-mode.comingsoon-mode {
            transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%);
            transform-origin: center center;
            filter: brightness(0.9);
        }
        
        /* Vine wrapper perspective transforms (same as canvas) */
        .vineWrapper.longago-mode {
            transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%);
            transform-origin: center center;
        }
        
        .vineWrapper.comingsoon-mode {
            transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%);
            transform-origin: center center;
        }
        
        .vineWrapper.thinner-mode.longago-mode {
            transform: perspective(650px) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%);
            transform-origin: center center;
        }
        
        .vineWrapper.thinner-mode.comingsoon-mode {
            transform: perspective(650px) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%);
            transform-origin: center center;
        }
        
        .vineWrapper.thicker-mode.longago-mode {
            transform: perspective(650px) rotateX(45deg) scale(1.5) translateY(-28%);
            transform-origin: center center;
        }
        
        .vineWrapper.thicker-mode.comingsoon-mode {
            transform: perspective(650px) rotateX(-45deg) scale(1.5) translateY(28%);
            transform-origin: center center;
        }
        
        .settings-btn {
            position: absolute;
            top: 12px;
            right: 20px;
            padding: 8px 16px;
            font-size: 14px;
            background: #2a2a3a;
            color: #ccc;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.15s;
            z-index: 10;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        .settings-btn:hover {
            background: #3a3a4a;
            border-color: rgba(110, 181, 255, 0.3);
            color: #fff;
        }
        
        /* Hide UI elements during gameplay */
        .hidden-during-play {
            display: none !important;
        }
        
        .mode-menu {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: transparent;
            padding: 20px;
            box-sizing: border-box;
            pointer-events: none;
            z-index: 10; /* Ensure tooltips appear above left panel */
        }
        .mode-menu.hidden {
            display: none;
        }
        .mode-menu-heading {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 20px;
            color: white;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }
        .well-title {
            font-size: 3.5vh;
            font-weight: bold;
            font-family: 'Orbitron', sans-serif;
            background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-shadow: none;
            letter-spacing: 0.3vh;
            position: relative;
            z-index: 1;
            filter: drop-shadow(0 0.2vh 0.4vh rgba(255, 215, 0, 0.5))
                    drop-shadow(0 0.4vh 0.8vh rgba(0, 0, 0, 0.7));
            text-align: center;
            margin-bottom: 5vh;
        }
        .mode-button {
            width: 90%;
            max-width: 250px;
            pointer-events: auto;
            margin: 6px 0;
            padding: 12px 20px;
            font-size: 16px;
            font-weight: 600;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 100%);
            color: #e0e0e0;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
            text-shadow: none;
        }
        .mode-button:hover {
            background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
            border-color: rgba(110, 181, 255, 0.5);
            color: #fff;
            transform: translateY(-1px);
        }
        .mode-button:active {
            transform: translateY(0);
        }
        .mode-button.selected {
            background: linear-gradient(180deg, #3d5a80 0%, #2d4a70 100%);
            border-color: #6eb5ff;
            color: #fff;
            box-shadow: 0 0 20px rgba(110, 181, 255, 0.3);
        }
        .mode-button[data-tooltip] {
            position: relative;
        }
        .mode-button[data-tooltip]:hover::after {
            content: attr(data-tooltip);
            position: absolute;
            left: 110%;
            top: 50%;
            transform: translateY(-50%);
            background: #1a1a2a;
            color: #ccc;
            padding: 10px 14px;
            border-radius: 6px;
            font-size: 12px;
            font-weight: 400;
            white-space: nowrap;
            z-index: 9999;
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
            pointer-events: none;
            animation: tooltipFadeIn 0.15s ease-out;
        }
        .mode-button[data-tooltip]:hover::before {
            content: '';
            position: absolute;
            left: 100%;
            top: 50%;
            transform: translateY(-50%);
            border: 6px solid transparent;
            border-right-color: #1a1a2a;
            z-index: 9998;
            pointer-events: none;
        }
        @keyframes tooltipFadeIn {
            from {
                opacity: 0;
                transform: translateY(-50%) translateX(5px);
            }
            to {
                opacity: 1;
                transform: translateY(-50%) translateX(0);
            }
        }
        .game-credits {
            margin-top: 20px;
            font-size: 12px;
            color: rgba(255, 255, 255, 0.7);
            text-align: center;
            line-height: 1.6;
        }
        .game-credits a {
            color: rgba(255, 255, 255, 0.9);
            text-decoration: none;
        }
        .game-credits a:hover {
            color: #fff;
        }
        .challenge-selector {
            margin-bottom: 25px;
            text-align: center;
            pointer-events: auto;
            width: 90%;
            max-width: 290px;
        }
        .challenge-selector .mode-menu-heading {
            margin-bottom: 6px !important;
            margin-top: 0 !important;
            padding: 0 !important;
            line-height: 1.2;
        }
        .challenge-select-btn {
            margin-top: 2px !important;
        }
        .challenge-selector label {
            display: block;
            margin-bottom: 8px;
            font-size: 18px;
            font-weight: bold;
            color: white;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }
        .challenge-select-btn {
            width: 100%;
            padding: 10px 15px;
            font-size: 14px;
            background: rgba(0, 0, 0, 0.6);
            color: white;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-radius: 5px;
            cursor: pointer;
            text-align: center;
            box-sizing: border-box;
            transition: all 0.2s ease;
        }
        .challenge-select-btn:hover {
            border-color: rgba(255, 255, 255, 0.5);
            background: rgba(0, 0, 0, 0.7);
        }
        .challenge-select-btn:focus {
            outline: none;
            border-color: rgba(255, 255, 255, 0.7);
        }
        .challenge-select-btn::after {
            content: ' ▼';
            font-size: 10px;
            opacity: 0.7;
        }

        /* ─── Menu Dropdown Group ─── */
        .menu-dropdown-group {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0;
            width: 90%;
            max-width: 340px;
            pointer-events: auto;
        }
        .menu-dropdown-wrapper {
            position: relative;
            width: 100%;
            margin-top: max(2.5vh, 16px);
        }
        .menu-dropdown-wrapper:first-child {
            margin-top: 0;
        }
        .menu-dropdown-label {
            font-size: max(1.2vh, 10px);
            color: #888;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin: 0 0 max(0.4vh, 3px) 0;
            padding: 0;
            line-height: 1.2;
            text-align: left;
            font-weight: 500;
        }
        .menu-dropdown-btn {
            width: 100%;
            margin: 0;
            padding: max(1.2vh, 10px) max(1.5vw, 15px);
            font-size: max(1.8vh, 14px);
            font-weight: 600;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 100%);
            color: #e0e0e0;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: max(0.8vh, 6px);
            cursor: pointer;
            transition: all 0.2s;
            text-align: center;
            box-sizing: border-box;
            pointer-events: auto;
        }
        .menu-dropdown-btn::after {
            content: ' ▼';
            font-size: max(1.2vh, 10px);
            opacity: 0.7;
        }
        .menu-dropdown-btn:hover {
            background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
            border-color: rgba(110, 181, 255, 0.5);
            color: #fff;
            transform: translateY(-1px);
        }
        .menu-dropdown-btn:active {
            transform: translateY(0);
        }
        .menu-dropdown-btn.active {
            border-color: rgba(110, 181, 255, 0.7);
            background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
        }
        .menu-start-game-btn {
            margin-top: max(3.5vh, 22px);
            padding: max(1.6vh, 14px) max(4vw, 30px);
            font-size: max(2vh, 16px);
            font-weight: 600;
            white-space: nowrap;
            background: linear-gradient(180deg, #5a9ae8 0%, #2d5fb8 100%);
            color: #fff;
            border: none;
            border-radius: max(0.8vh, 6px);
            cursor: pointer;
            transition: all 0.15s;
            box-shadow: 0 max(0.4vh, 3px) max(2vh, 15px) rgba(61, 125, 212, 0.3);
            text-transform: uppercase;
            letter-spacing: 1px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            pointer-events: auto;
            width: 100%;
            text-shadow: 0 max(0.2vh, 1px) max(0.4vh, 3px) rgba(0, 0, 0, 0.4);
        }
        .menu-start-game-btn:hover {
            background: linear-gradient(180deg, #6aaaf0 0%, #3d6fc8 100%);
            transform: translateY(-1px);
            box-shadow: 0 max(0.6vh, 4px) max(2.5vh, 18px) rgba(61, 125, 212, 0.4);
        }
        .menu-start-game-btn:active {
            transform: translateY(0);
        }
        /* Leaderboard Styles */
        .leaderboard-container {
            padding: 1.5vh 1vw;
            color: white;
            overflow-y: auto;
            overflow-x: hidden;
            max-height: 100%;
        }
        
        #leaderboardContent {
            color: #e0e0e0;
            overflow-y: auto;
            overflow-x: hidden;
            height: 100%;
            pointer-events: auto;
            position: relative;
            z-index: 10;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        
        .leaderboard-title {
            font-size: max(1.8vh, 10px);
            font-weight: 600;
            text-align: center;
            margin-bottom: 0.4vh;
            color: #6eb5ff;
        }
        
        .leaderboard-mode-selector {
            text-align: center;
            margin-bottom: 1.2vh;
            font-size: max(1.2vh, 8px);
            color: #888;
        }
        
        .leaderboard-mode-selector .current-mode {
            color: #6eb5ff;
            font-weight: 600;
        }
        
        .leaderboard-table {
            width: 100%;
            border-collapse: collapse;
            font-size: max(1.25vh, 9px);
            overflow: hidden;
            position: relative;
            line-height: 1.35;
        }
        
        .leaderboard-table th {
            background: #1a1a2e;
            padding: 0.55vh 0.35vw;
            text-align: left;
            border-bottom: 1px solid rgba(110, 181, 255, 0.3);
            font-weight: 600;
            color: #aaa;
            text-transform: uppercase;
            font-size: max(0.95vh, 7px);
            letter-spacing: 0.5px;
            position: sticky;
            top: 0;
            z-index: 1;
        }
        
        .leaderboard-table td {
            padding: 0.55vh 0.35vw;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        }
        
        .leaderboard-table tr:nth-child(even) {
            background: rgba(255, 255, 255, 0.02);
        }
        
        .leaderboard-table tr.player-score {
            background: rgba(110, 181, 255, 0.15);
            font-weight: 600;
            color: #6eb5ff;
        }
        
        .leaderboard-table .rank {
            width: 30px;
            text-align: center;
            font-weight: 600;
            color: #888;
        }
        
        .leaderboard-table .name {
            width: 22%;
        }
        
        .leaderboard-table .score {
            width: 20%;
        }
        
        .special-events {
            font-size: max(1vh, 7px);
            color: #888;
        }
        
        .leaderboard-table .events-col {
            width: 18%;
            font-size: max(1.05vh, 8px);
            color: #888;
            line-height: 1.35;
        }
        
        .super-event-glow {
            text-shadow: 0 0 0.6vh #FFD700, 0 0 1.2vh #FFD700, 0 0 1.8vh #FFA500;
            filter: brightness(1.3);
            cursor: help;
        }
        
        .leaderboard-table .challenges-col {
            width: 8%;
            text-align: center;
            cursor: help;
        }
        
        .leaderboard-table .replay-col {
            width: 5%;
            text-align: center;
        }
        
        .replay-btn {
            cursor: pointer;
            opacity: 0.7;
            transition: opacity 0.2s, transform 0.2s;
            font-size: 12px;
        }
        
        .replay-btn:hover {
            opacity: 1;
            transform: scale(1.2);
        }
        
        .replay-btn.no-recording {
            opacity: 0.2;
            filter: grayscale(1);
            cursor: pointer;
        }
        
        .replay-btn.no-recording:hover {
            opacity: 0.35;
            transform: scale(1.1);
        }
        
        .challenge-count {
            display: inline-block;
            background: rgba(110, 181, 255, 0.2);
            color: #6eb5ff;
            padding: 2px 6px;
            border-radius: 4px;
            font-weight: 600;
            font-size: 11px;
            pointer-events: auto;
        }
        
        .leaderboard-table tr.has-challenges {
            cursor: help;
        }
        
        .leaderboard-table tr.has-challenges td {
            cursor: help;
        }
        
        .leaderboard-table tr.has-challenges:hover {
            background: rgba(110, 181, 255, 0.1) !important;
        }
        
        .leaderboard-loading {
            text-align: center;
            padding: 40px;
            font-size: 16px;
            color: #888;
        }
        
        .leaderboard-error {
            text-align: center;
            padding: 40px;
            color: #ff6b6b;
        }
        
        /* Name Entry Modal */
        .name-entry-overlay {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: 100% !important;
            background: rgba(0, 0, 0, 0.85) !important;
            z-index: 99999 !important;
            display: none;
            justify-content: center !important;
            align-items: center !important;
            pointer-events: all !important;
        }
        
        .name-entry-popup {
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            padding: 36px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            min-width: 380px;
            max-width: 480px;
            position: relative;
            z-index: 100000;
            display: block !important;
            pointer-events: auto;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        
        .name-entry-title {
            font-size: 24px;
            font-weight: 600;
            color: #6eb5ff;
            text-align: center;
            margin-bottom: 16px;
        }
        
        .name-entry-message {
            font-size: 15px;
            color: #aaa;
            text-align: center;
            margin-bottom: 24px;
            line-height: 1.6;
        }
        
        .name-entry-score {
            font-size: 22px;
            color: #fff;
            font-weight: 600;
        }
        
        .name-entry-input {
            width: 100%;
            padding: 14px;
            font-size: 16px;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 6px;
            background: #2a2a3a;
            color: #e0e0e0;
            text-align: center;
            margin-bottom: 16px;
            box-sizing: border-box;
            touch-action: manipulation;
            -webkit-appearance: none;
            -webkit-tap-highlight-color: transparent;
            -webkit-user-select: text;
            user-select: text;
            font-family: inherit;
        }
        
        .name-entry-input:focus {
            outline: none;
            border-color: #6eb5ff;
            box-shadow: 0 0 0 3px rgba(110, 181, 255, 0.15);
        }
        
        .name-entry-button {
            width: 100%;
            padding: 14px;
            font-size: 16px;
            background: #3d7dd4;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.2s;
            font-weight: 500;
            font-family: inherit;
        }
        
        .name-entry-button:hover {
            background: #4a8de4;
        }
        
        .name-entry-button:disabled {
            background: #3a3a4a;
            color: #666;
            cursor: not-allowed;
        }
        
        /* Phone landscape: move name entry popup to top so on-screen keyboard doesn't cover input */
        @media (max-height: 500px) and (pointer: coarse) {
            .name-entry-overlay {
                align-items: flex-start !important;
                padding-top: 1vh !important;
            }
            .name-entry-popup {
                padding: 1.5vh 3vw;
                min-width: auto;
                max-width: 60vw;
            }
            .name-entry-title {
                font-size: max(2.5vh, 14px);
                margin-bottom: 0.5vh;
            }
            .name-entry-message {
                font-size: max(1.8vh, 12px);
                margin-bottom: 1vh;
                line-height: 1.3;
            }
            .name-entry-score {
                font-size: max(2.2vh, 14px);
            }
            .name-entry-input {
                padding: 1vh;
                font-size: max(2vh, 14px);
                margin-bottom: 1vh;
            }
            .name-entry-button {
                padding: 1vh;
                font-size: max(2vh, 14px);
            }
        }
        
        /* Tablet landscape: shift name entry popup toward top so on-screen keyboard doesn't obscure it */
        @media (min-height: 501px) and (max-height: 1100px) and (pointer: coarse) and (min-width: 768px) {
            .name-entry-overlay {
                align-items: flex-start !important;
                padding-top: 5vh !important;
            }
            .name-entry-popup {
                padding: 2.5vh 3vw;
                min-width: 280px;
                max-width: 50vw;
            }
        }
        
        /* Color Palette Dropdown */
        .palette-dropdown {
            position: relative;
            width: 270px;
            display: flex;
            align-items: center;
        }
        
        .palette-dropdown-button {
            width: 100%;
            padding: 6px 10px;
            background: rgba(0,0,0,0.5);
            border: 1px solid #555;
            border-radius: 4px;
            color: #fff;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            font-size: 13px;
            box-sizing: border-box;
        }
        
        .palette-dropdown-button:hover {
            border-color: #777;
        }
        
        .palette-color-row {
            display: flex;
            gap: 2px;
        }
        
        .palette-color-swatch {
            width: 12px;
            height: 12px;
            border-radius: 2px;
            border: 1px solid rgba(255,255,255,0.2);
            flex-shrink: 0;
        }
        
        .palette-dropdown-menu {
            position: absolute;
            top: 100%;
            right: 0;
            min-width: 280px;
            margin-top: 4px;
            background: #1e1e2e;
            border: 1px solid #444;
            border-radius: 8px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.4);
            z-index: 1000;
            max-height: 300px;
            overflow-y: auto;
            overflow-x: hidden;
            display: none;
        }
        
        /* .open class no longer used - inline styles control visibility */
        
        .palette-category-header {
            padding: 6px 12px;
            background: #252535;
            color: #888;
            font-size: 10px;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
            position: sticky;
            top: 0;
        }
        
        .palette-option {
            padding: 6px 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .palette-option:hover {
            background: #2a2a3e;
        }
        
        .palette-option.selected {
            background: #3a3a4e;
        }
        
        .palette-option-name {
            color: #ddd;
            font-size: 12px;
            white-space: nowrap;
        }
        
        .settings-divider {
            height: 1px;
            background: rgba(255, 255, 255, 0.15);
            margin: 8px 0;
        }
        /* ============================================ */
        /* RESPONSIVE: Small/Phone Landscape            */
        /* ============================================ */
        
        /* Mid-size viewports - flexbox layout, canvas shrinks for panels */
        @media (max-width: 1100px) {
            .well-title {
                font-size: max(2.5vh, 14px);
                letter-spacing: 0.2vh;
            }
            .content-area {
                height: 100vh;
                height: 100dvh;
                padding: 0;
                flex: 1;
            }
            /* Panels fill available space */
            .game-container {
                justify-content: stretch;
                align-items: stretch;
                gap: 0.3vw;
                max-height: 100vh;
                max-height: 100dvh;
                height: 100vh;
                height: 100dvh;
                padding: 0 0.3vw;
            }
            .rules-panel, .side-panel {
                flex: 1 1 0;
                width: auto;
                min-width: 0;
                max-width: none;
                height: 100vh;
                height: 100dvh;
                flex-shrink: 1;
                flex-grow: 1;
                border-radius: 0;
                border-left: none;
                border-right: none;
            }
            /* Override tablet-mode panel sizing at narrow viewports */
            body.tablet-mode .rules-panel,
            body.tablet-mode .side-panel {
                width: auto;
                min-width: 0;
                max-width: none;
                flex: 1 1 0;
            }
            .rules-panel {
                border-right: 1px solid rgba(255, 255, 255, 0.08);
            }
            .side-panel {
                border-left: 1px solid rgba(255, 255, 255, 0.08);
            }
            .main-area {
                flex-shrink: 0;
                flex-grow: 0;
                height: 100vh;
                height: 100dvh;
                border-radius: 0;
                padding: 0;
            }
            canvas {
                max-height: 100vh;
                max-height: 100dvh;
                border-width: 0.2vh;
            }
            .intro-title {
                font-size: max(3vw, 20px);
            }
            .intro-controls {
                gap: 0;
                margin-top: 2vh;
            }
            .intro-toggle {
                width: min(320px, 85vw);
                padding: 1.5vh 2.5vw;
                gap: 2vw;
                border-radius: 1vh;
            }
            .intro-dropdown-wrapper {
                width: min(320px, 85vw);
            }
            .intro-dropdowns-row {
                flex-direction: row;
                align-items: flex-start;
                gap: max(0.5vw, 4px);
                width: min(320px, 85vw);
            }
            .intro-dropdowns-row .intro-dropdown-wrapper {
                flex: 1;
                width: auto;
                margin-top: 0;
            }
            .intro-dropdowns-row .menu-dropdown-btn {
                font-size: max(1.6vh, 11px);
            }
            .intro-toggles-row {
                width: min(320px, 85vw);
            }
            .intro-toggles-row .intro-toggle {
                width: auto;
                padding: 1.5vh 2vw;
            }
            .intro-toggle-label {
                font-size: max(1.8vh, 12px);
            }
            .intro-toggle select {
                font-size: max(1.6vh, 11px);
                max-width: 28vw;
            }
            .start-game-btn {
                margin-top: max(4vh, 20px) !important;
                margin-bottom: max(4vh, 20px);
                padding: 2.5vh 6vw;
                font-size: max(2vh, 14px);
                border-radius: 1vh;
                width: min(320px, 85vw);
            }
            .combo-modal {
                padding: 12px 16px;
                max-height: 90vh;
            }
            .combo-modal-title {
                font-size: 14px;
                margin-bottom: 6px;
            }
            .game-over {
                top: 2%;
                padding: 12px 20px;
                font-size: 14px;
                min-width: 150px;
            }
            .game-over > div:first-child {
                font-size: 22px !important;
                margin-bottom: 6px !important;
            }
            .gameover-share-row {
                gap: 8px;
                margin-top: 10px;
                margin-bottom: 4px;
            }
            .gameover-share-icon {
                width: 28px;
                height: 28px;
            }
            .credits-role {
                width: 45vw;
                padding-left: 2vw;
            }
            .credits-name {
                width: 40vw;
            }
            .credits-row {
                gap: 4vw;
                font-size: 14px;
            }
            .selection-option {
                padding: max(0.8vh, 6px) max(1.2vw, 10px);
            }
            /* Settings button scales down */
            .settings-btn {
                padding: 0.8vh 1.2vw;
                font-size: max(1.5vh, 11px);
                top: 1vh;
                right: 1vw;
            }
            /* Mode menu headings scale */
            .mode-menu {
                padding: 1vh 2vw;
                justify-content: center;
                gap: 0;
            }
            .well-title {
                margin-bottom: 0.3vh;
                font-size: max(2vh, 12px);
                margin-top: 3vh;
            }
            .mode-menu-heading {
                font-size: max(1.6vh, 11px);
                margin-bottom: 0.3vh;
                white-space: nowrap;
            }
            .challenge-selector {
                margin-top: max(2vh, 10px);
                margin-bottom: max(1.5vh, 8px);
            }
            .challenge-select-btn {
                padding: 1.2vh 2vw;
                font-size: max(1.8vh, 12px);
            }
            .mode-button {
                margin: max(0.8vh, 4px) 0;
                padding: 1.2vh 3vw;
                font-size: max(2vh, 13px);
                border-radius: 1vh;
                white-space: nowrap;
            }
            .menu-dropdown-group {
                gap: 0;
                width: 100%;
                max-width: none;
            }
            .menu-dropdown-btn {
                padding: max(1vh, 8px) max(1.2vw, 10px);
                font-size: max(1.6vh, 12px);
            }
            .menu-start-game-btn {
                padding: max(1.4vh, 10px) max(3vw, 20px);
                font-size: max(1.8vh, 13px);
            }
        }
        
        /* Very small landscape (phone landscape) */
        @media (max-height: 500px) {
            .well-title {
                font-size: max(2.5vh, 12px);
            }
            .content-area {
                height: 100vh;
                height: 100dvh;
                padding: 0;
            }
            .game-container {
                max-height: 100vh;
                max-height: 100dvh;
                height: 100vh;
                height: 100dvh;
                gap: 0.3vw;
                justify-content: stretch;
                align-items: stretch;
                padding: 0 0.3vw;
            }
            .main-area {
                height: 100vh;
                height: 100dvh;
                flex-shrink: 0;
                border-radius: 0;
            }
            canvas {
                max-height: 100vh;
                max-height: 100dvh;
            }
            .side-panel, .rules-panel {
                height: 100vh;
                height: 100dvh;
                min-width: 0;
                max-width: none;
                flex: 1 1 0;
                padding: 1vh 1vw;
                font-size: max(1.4vh, 10px);
                border-radius: 0;
            }
            .settings-btn {
                position: fixed !important;
                top: 4px !important;
                right: 1vw !important;
                margin: 0 !important;
                padding: 0.3vh 1vw;
                font-size: max(1.3vh, 9px);
            }
            .pause-btn {
                position: fixed !important;
                top: 4px !important;
                margin: 0 !important;
            }
            #gestureGuide {
                text-align: center;
                margin: auto 0;
            }
            .side-panel .side-panel-bottom {
                flex: 1 !important;
                flex-grow: 1 !important;
                display: flex !important;
                flex-direction: column !important;
                justify-content: center !important;
            }
            .score-display {
                margin-bottom: 0.3vh;
            }
            .score-label {
                font-size: max(1.3vh, 9px);
            }
            .next-canvas-wrapper {
                margin-top: 1vh;
                margin-bottom: 0.3vh;
            }
            .intro-title {
                font-size: max(5vh, 20px);
            }
            .intro-controls {
                gap: 0;
                margin-top: 1vh;
            }
            .intro-toggle {
                padding: 1vh 2vw;
                width: min(320px, 50vw);
            }
            .intro-dropdown-wrapper {
                width: min(320px, 50vw);
            }
            .intro-dropdowns-row {
                flex-direction: row;
                align-items: flex-start;
                gap: max(0.5vw, 4px);
                width: min(320px, 50vw);
            }
            .intro-dropdowns-row .intro-dropdown-wrapper {
                flex: 1;
                width: auto;
                margin-top: 0;
            }
            .intro-dropdowns-row .menu-dropdown-btn {
                font-size: max(1.4vh, 10px);
            }
            .intro-toggles-row {
                width: min(320px, 50vw);
            }
            .intro-toggles-row .intro-toggle {
                width: auto;
                padding: 1vh 1.5vw;
            }
            .start-game-btn {
                margin-top: max(3vh, 16px);
                margin-bottom: max(3vh, 16px);
                padding: 2vh 5vw;
                width: min(320px, 50vw);
            }
            .mode-button {
                margin: max(1.5vh, 8px) 0;
                padding: 1vh 2vw;
                white-space: nowrap;
            }
            .challenge-selector {
                margin-top: max(4vh, 18px);
                margin-bottom: max(3vh, 14px);
            }
            /* Tooltip goes below on small screens to avoid overflow */
            .mode-button[data-tooltip]:hover::after {
                left: 50%;
                top: 110%;
                transform: translateX(-50%);
                white-space: normal;
                max-width: 60vw;
                font-size: max(1.4vh, 10px);
            }
            .mode-button[data-tooltip]:hover::before {
                display: none;
            }
            .settings-column-right {
                display: none !important;
            }
            .settings-popup {
                font-size: 12px;
            }
            .settings-option label,
            .settings-option .toggle-label-text {
                font-size: 12px;
            }
            .settings-title {
                font-size: 14px;
            }
            .label-full {
                display: none;
            }
            .label-short {
                display: inline;
            }
            .settings-divider {
                margin: 2.5vh 0;
            }
            /* Long Ago / Coming Soon adjustments for phones */
            canvas.longago-mode {
                transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) !important;
            }
            canvas.comingsoon-mode {
                transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) !important;
            }
            canvas.thinner-mode.longago-mode {
                transform: perspective(65vh) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%) !important;
            }
            canvas.thinner-mode.comingsoon-mode {
                transform: perspective(65vh) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%) !important;
            }
            canvas.thicker-mode.longago-mode {
                transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) !important;
            }
            canvas.thicker-mode.comingsoon-mode {
                transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) !important;
            }
            .vineWrapper.longago-mode {
                transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) !important;
            }
            .vineWrapper.comingsoon-mode {
                transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) !important;
            }
            /* Phone-specific nervous keyframes with reduced perspective */
            @keyframes nervousShakeLongAgoPhone {
                0%, 100% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(0, 0); }
                10% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.5vh, 0.3vh); }
                20% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(0.6vh, -0.4vh); }
                30% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.4vh, 0.6vh); }
                40% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(0.5vh, -0.3vh); }
                50% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.6vh, 0.4vh); }
                60% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(0.3vh, -0.6vh); }
                70% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.4vh, 0.3vh); }
                80% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(0.6vh, -0.5vh); }
                90% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translate(-0.3vh, 0.5vh); }
            }
            @keyframes nervousShakeComingSoonPhone {
                0%, 100% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(0, 0); }
                10% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.5vh, 0.3vh); }
                20% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(0.6vh, -0.4vh); }
                30% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.4vh, 0.6vh); }
                40% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(0.5vh, -0.3vh); }
                50% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.6vh, 0.4vh); }
                60% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(0.3vh, -0.6vh); }
                70% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.4vh, 0.3vh); }
                80% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(0.6vh, -0.5vh); }
                90% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translate(-0.3vh, 0.5vh); }
            }
            @keyframes nervousShakeThinnerLongAgoPhone {
                0%, 100% { transform: perspective(65vh) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%) translateX(0); }
                25% { transform: perspective(65vh) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%) translateX(-0.3vh); }
                75% { transform: perspective(65vh) rotateX(45deg) scaleX(0.6) scale(1.5) translateY(-28%) translateX(0.3vh); }
            }
            @keyframes nervousShakeThinnerComingSoonPhone {
                0%, 100% { transform: perspective(65vh) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%) translateX(0); }
                25% { transform: perspective(65vh) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%) translateX(-0.3vh); }
                75% { transform: perspective(65vh) rotateX(-45deg) scaleX(0.6) scale(1.5) translateY(28%) translateX(0.3vh); }
            }
            @keyframes nervousShakeThickerLongAgoPhone {
                0%, 100% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translateX(0); }
                25% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translateX(-0.3vh); }
                75% { transform: perspective(65vh) rotateX(45deg) scale(1.5) translateY(-28%) translateX(0.3vh); }
            }
            @keyframes nervousShakeThickerComingSoonPhone {
                0%, 100% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translateX(0); }
                25% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translateX(-0.3vh); }
                75% { transform: perspective(65vh) rotateX(-45deg) scale(1.5) translateY(28%) translateX(0.3vh); }
            }
            canvas.nervous-active.longago-mode {
                animation: nervousShakeLongAgoPhone 0.1s infinite linear !important;
            }
            canvas.nervous-active.comingsoon-mode {
                animation: nervousShakeComingSoonPhone 0.1s infinite linear !important;
            }
            canvas.nervous-active.thinner-mode.longago-mode {
                animation: nervousShakeThinnerLongAgoPhone 0.1s infinite linear !important;
            }
            canvas.nervous-active.thinner-mode.comingsoon-mode {
                animation: nervousShakeThinnerComingSoonPhone 0.1s infinite linear !important;
            }
            canvas.nervous-active.thicker-mode.longago-mode {
                animation: nervousShakeThickerLongAgoPhone 0.1s infinite linear !important;
            }
            canvas.nervous-active.thicker-mode.comingsoon-mode {
                animation: nervousShakeThickerComingSoonPhone 0.1s infinite linear !important;
            }
            /* Give panels more room on phones with perspective modes */
            body:has(canvas.longago-mode) .game-container,
            body:has(canvas.comingsoon-mode) .game-container {
                gap: 0;
            }
            body:has(canvas.longago-mode) .side-panel,
            body:has(canvas.comingsoon-mode) .side-panel,
            body:has(canvas.longago-mode) .rules-panel,
            body:has(canvas.comingsoon-mode) .rules-panel {
                z-index: 20;
                position: relative;
                background: linear-gradient(180deg, rgba(26, 26, 46, 1) 0%, rgba(22, 33, 62, 1) 100%) !important;
                flex: 1.35 1 0 !important;
                font-size: 0.92em !important;
                padding: 0.8vh 0.8vw !important;
            }
            body:has(canvas.longago-mode) .main-area,
            body:has(canvas.comingsoon-mode) .main-area {
                z-index: 10;
                overflow: visible !important;
                flex-grow: 1.8 !important;
            }
        }
        
        /* Phone-width narrow screens (portrait would need more work) */
        @media (max-width: 600px) {
            .rules-panel {
                display: none;
            }
            .side-panel {
                min-width: 130px;
                width: 30vw;
                max-width: 28vw;
            }
        }
        /* Portrait orientation overlay for mobile */
        #portraitOverlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            height: 100dvh;
            background: linear-gradient(180deg, #0a0a1a 0%, #1a1a3e 50%, #0a0a1a 100%);
            z-index: 99999;
            justify-content: center;
            align-items: center;
            text-align: center;
        }
        .portrait-overlay-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2vh;
        }
        .rotate-icon {
            font-size: 15vh;
            animation: rotatePhone 2s ease-in-out infinite;
            display: inline-block;
        }
        @keyframes rotatePhone {
            0%, 100% { transform: rotate(0deg); }
            30%, 70% { transform: rotate(90deg); }
        }
        .rotate-text {
            font-size: max(2.5vh, 18px);
            color: #fff;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            font-weight: 600;
        }
        .rotate-subtext {
            font-size: max(1.8vh, 14px);
            color: #888;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        }
        @media (orientation: portrait) and (max-width: 1024px) and (pointer: coarse) {
            #portraitOverlay {
                display: flex;
            }
        }

        /* Share Popup */
        .share-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10000;
            display: none;
            justify-content: center;
            align-items: center;
            backdrop-filter: blur(0.4vh);
        }
        .share-overlay.active {
            display: flex;
        }
        .share-popup {
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            border: 0.15vh solid rgba(255, 215, 0, 0.25);
            border-radius: 1.2vh;
            padding: 3.5vh 3vw;
            max-width: min(92vw, 42vh);
            width: 100%;
            position: relative;
            box-shadow: 0 0 3vh rgba(255, 215, 0, 0.08), 0 2vh 6vh rgba(0, 0, 0, 0.6);
            text-align: center;
            animation: sharePopIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        }
        @keyframes sharePopIn {
            0% { transform: scale(0.85); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }
        .share-close {
            position: absolute;
            top: 1.2vh;
            right: 1.2vw;
            background: none;
            border: none;
            color: #666;
            font-size: 2.8vh;
            cursor: pointer;
            line-height: 1;
            transition: color 0.2s;
            padding: 0.5vh;
        }
        .share-close:hover { color: #fff; }
        .share-emoji { font-size: 4.5vh; margin-bottom: 1.5vh; }
        .share-title {
            font-family: 'Orbitron', sans-serif;
            font-size: 2.2vh;
            font-weight: 700;
            background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 1vh;
            letter-spacing: 0.15vh;
        }
        .share-subtitle {
            color: #9aa8c7;
            font-size: 1.6vh;
            margin-bottom: 3vh;
            line-height: 1.5;
        }
        .share-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1.5vh 1.5vw;
            margin-bottom: 3vh;
        }
        .share-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.8vh;
            padding: 1.5vh 0;
            border-radius: 0.8vh;
            border: 0.12vh solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.04);
            cursor: pointer;
            transition: all 0.2s;
            text-decoration: none;
        }
        .share-btn:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.2);
            transform: translateY(-0.2vh);
        }
        .share-btn svg { width: 3vh; height: 3vh; }
        .share-btn span {
            font-size: 1.2vh;
            color: #8899b0;
            text-transform: uppercase;
            letter-spacing: 0.08vh;
            font-weight: 600;
        }
        .share-btn.x-twitter:hover { border-color: #1da1f2; }
        .share-btn.x-twitter:hover span { color: #1da1f2; }
        .share-btn.facebook:hover { border-color: #1877f2; }
        .share-btn.facebook:hover span { color: #1877f2; }
        .share-btn.reddit:hover { border-color: #ff4500; }
        .share-btn.reddit:hover span { color: #ff4500; }
        .share-btn.whatsapp:hover { border-color: #25d366; }
        .share-btn.whatsapp:hover span { color: #25d366; }
        .share-btn.telegram:hover { border-color: #0088cc; }
        .share-btn.telegram:hover span { color: #0088cc; }
        .share-btn.copy-link:hover { border-color: #FFD700; }
        .share-btn.copy-link:hover span { color: #FFD700; }
        .share-dismiss {
            display: inline-flex;
            align-items: center;
            gap: 0.6vw;
            color: #556;
            font-size: 1.3vh;
            cursor: pointer;
            border: none;
            background: none;
            padding: 0.6vh 0;
            transition: color 0.2s;
        }
        .share-dismiss:hover { color: #99a; }
        .share-dismiss svg { width: 1.5vh; height: 1.5vh; opacity: 0.5; }

        /* Phone: make share popup fill most of the screen */
        @media (pointer: coarse) and (max-width: 1024px) {
            .share-popup {
                max-width: 52vw;
                padding: 5vh 5vw;
            }
            .share-close {
                top: -2vh !important;
                right: 1vw !important;
                font-size: 7vh !important;
                padding: 0 !important;
                line-height: 0.7 !important;
            }
            .share-popup {
                overflow: visible;
            }
            .share-title {
                font-size: 3.5vh;
            }
            .share-subtitle {
                font-size: 2.4vh;
            }
            .share-emoji {
                font-size: 6vh;
            }
            .share-grid {
                gap: 2.5vh 3vw;
            }
            .share-btn {
                padding: 2.5vh 0;
            }
            .share-btn svg {
                width: 5vh;
                height: 5vh;
            }
            .share-btn span {
                font-size: 2vh;
            }
            .share-dismiss {
                font-size: 2vh;
            }
        }

        /* First-time player hint popup */
        .hint-popup {
            position: absolute;
            top: 33%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: linear-gradient(135deg, rgba(20, 20, 50, 0.95) 0%, rgba(10, 25, 55, 0.95) 100%);
            border: 0.2vh solid rgba(255, 215, 0, 0.4);
            border-radius: 1.2vh;
            padding: 2.5vh 1.5vw;
            color: #fff;
            font-size: max(1.8vh, 13px);
            text-align: center;
            z-index: 100;
            max-width: 95%;
            width: 72%;
            line-height: 1.5;
            box-shadow: 0 0 3vh rgba(255, 215, 0, 0.15), 0 1vh 4vh rgba(0, 0, 0, 0.6);
            animation: hintFadeIn 0.4s ease-out;
            pointer-events: auto;
            cursor: pointer;
        }
        .hint-popup::after {
            content: '▶';
            display: block;
            margin-top: 1.2vh;
            font-size: max(1.3vh, 10px);
            color: rgba(255, 215, 0, 0.5);
            letter-spacing: 0.1vh;
        }
        @keyframes hintFadeIn {
            0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
            100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
        }
        @keyframes hintFadeOut {
            0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
            100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
        }
        
        /* Phone credits and game-over adjustments */
        @media (pointer: coarse) {
            .credits-content {
                max-width: 90%;
            }
            .credits-role {
                width: 35vw;
                padding-left: 0;
                text-align: right;
            }
            .credits-name {
                width: 35vw;
            }
            .credits-row {
                gap: 3vw;
                font-size: max(1.8vh, 13px);
            }
            .game-over {
                top: 2%;
                padding: 10px 16px;
                font-size: 13px;
            }
            .game-over > div:first-child {
                font-size: 20px !important;
                margin-bottom: 4px !important;
            }
        }

/* === Gamepad Focus Indicator === */
.gamepad-focus {
    outline: 0.3vh solid #FFD700 !important;
    outline-offset: 0.25vh;
    box-shadow: 0 0 1.2vh rgba(255, 215, 0, 0.45), inset 0 0 0.5vh rgba(255, 215, 0, 0.08) !important;
    transition: outline 0.12s ease, box-shadow 0.12s ease;
}

/* Ensure focus is visible on dark backgrounds */
.selection-option.gamepad-focus {
    border-color: #FFD700 !important;
}

.combo-checkbox-option label.gamepad-focus {
    border-radius: 0.6vh;
}

/* Pulsing animation for primary action buttons when focused */
.start-game-btn.gamepad-focus,
.menu-start-game-btn.gamepad-focus,
#playAgainBtn.gamepad-focus {
    animation: gamepadPulse 1.5s ease-in-out infinite;
}

@keyframes gamepadPulse {
    0%, 100% { box-shadow: 0 0 1.2vh rgba(255, 215, 0, 0.45); }
    50% { box-shadow: 0 0 2vh rgba(255, 215, 0, 0.7), 0 0 3vh rgba(255, 215, 0, 0.3); }
}
