        :root {
            --emerald: #004d26;
            --gold: #d4af37;
            --dark-gold: #aa8c2c;
            --deep-black: #0a0a0a;
            --glitch-green: #00ff41;
        }

        body {
            background-color: var(--deep-black);
            background-image: radial-gradient(circle at center, #1a2e1a 0%, #0a0a0a 100%);
            color: #d4af37;
            font-family: 'Cinzel', serif;
            text-align: center;
            margin: 0;
            padding: 20px;
            overflow-x: hidden;
        }

        h1 {
            color: var(--gold);
            font-size: 3em;
            text-shadow: 0 0 10px rgba(212, 175, 55, 0.5), 0 0 20px rgba(0, 77, 38, 0.8);
            margin-top: 80px;
            /* Space for top HUD */
            letter-spacing: 5px;
        }

        h2 {
            font-size: 2em;
            color: #bdc3c7;
            margin-top: 0;
        }

        .instructions {
            color: #bdc3c7;
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.2em;
            margin-bottom: 20px;
            font-style: italic;
        }

        canvas {
            background-color: #0c140c;
            border: 4px solid var(--gold);
            box-shadow: 0 0 50px rgba(0, 77, 38, 0.4), inset 0 0 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.2);
            image-rendering: auto;
            /* Smoother for sprites */
            max-width: 95vw;
            display: block;
            margin: 20px auto;
            transition: box-shadow 0.5s ease;
        }

        canvas:hover {
            box-shadow: 0 0 70px rgba(212, 175, 55, 0.3), inset 0 0 20px rgba(0, 77, 38, 0.5);
        }

        canvas.grid-mode {
            max-width: 90vw;
            max-height: 70vh;
            object-fit: contain;
            border-style: dashed;
            box-shadow: 0 0 50px rgba(0, 255, 65, 0.5);
        }

        #top-hud {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            display: flex;
            justify-content: center;
            gap: 40px;
            padding: 15px 30px;
            background: linear-gradient(180deg, rgba(5, 18, 8, 0.9) 0%, rgba(5, 18, 8, 0.7) 100%);
            backdrop-filter: blur(20px) saturate(180%);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            border-bottom: 2px solid rgba(212, 175, 55, 0.4);
            z-index: 1000;
            box-shadow: 0 4px 30px rgba(0, 0, 0, 0.8), inset 0 1px 1px rgba(255, 255, 255, 0.1);
            transition: all 0.4s ease;
        }

        #top-hud:hover {
            background: linear-gradient(180deg, rgba(5, 18, 8, 0.95) 0%, rgba(5, 25, 8, 0.8) 100%);
            border-bottom: 2px solid var(--gold);
        }

        #side-hud {
            position: fixed;
            left: 20px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            gap: 15px;
            z-index: 1000;
        }

        .hud-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            min-width: 80px;
        }

        .hud-stat-group {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .hud-icon {
            font-size: 1.2em;
            filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.5));
        }

        .hud-label {
            font-size: 0.65em;
            color: var(--dark-gold);
            text-transform: uppercase;
            letter-spacing: 2px;
            margin-bottom: 4px;
        }

        .hud-value {
            font-weight: 700;
            color: white;
            font-size: 1.1em;
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px var(--gold);
            font-family: 'Cinzel', serif;
        }

        .side-item {
            background: rgba(5, 18, 8, 0.8);
            backdrop-filter: blur(12px) saturate(150%);
            -webkit-backdrop-filter: blur(12px) saturate(150%);
            border: 1px solid rgba(212, 175, 55, 0.3);
            border-radius: 16px;
            padding: 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            width: 75px;
            height: 75px;
            justify-content: center;
            color: var(--gold);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
        }

        .side-item:hover {
            background: rgba(212, 175, 55, 0.15);
            border-color: var(--gold);
            color: var(--gold);
            transform: scale(1.15) translateX(8px);
            box-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
            filter: brightness(1.2);
        }

        .side-icon {
            font-size: 1.5em;
        }

        .side-label {
            font-size: 0.6em;
            text-transform: uppercase;
            font-weight: bold;
            letter-spacing: 1px;
            white-space: nowrap;
        }

        /* This hides the images used for preloading */
        .preload {
            display: none;
        }

        @keyframes pulse {
            0% {
                opacity: 0.8;
            }

            50% {
                opacity: 1;
            }

            100% {
                opacity: 0.8;
            }
        }

        #level-text {
            animation: pulse 2s infinite;
        }

        .center {
            display: block;
            margin-left: auto;
            margin-right: auto;
        }

        .bordered-text {
            border: 2px solid yellow;
            /* Shorthand for width, style, and color */
            padding: 5px;
            /* Adds space between the text and the border */
            display: inline-block;
            /* Allows padding/margin to be applied correctly */
        }

        /* Modal Styles */
        .modal {
            display: none;
            position: fixed;
            z-index: 100;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            justify-content: center;
            align-items: center;
            backdrop-filter: blur(8px);
        }

        .modal-content {
            background: linear-gradient(135deg, #051208 0%, #0a210f 100%);
            padding: 30px;
            border: 3px solid var(--gold);
            border-radius: 15px;
            width: 400px;
            max-width: 90%;
            box-shadow: 0 0 50px rgba(0, 255, 65, 0.2);
        }

        .modal-content h2 {
            color: var(--gold);
            margin-top: 0;
            font-family: 'Cinzel', serif;
        }

        textarea {
            width: 100%;
            height: 100px;
            background: #000;
            border: 1px solid var(--emerald);
            color: var(--glitch-green);
            padding: 10px;
            box-sizing: border-box;
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.1em;
            margin: 15px 0;
        }

        .modal-buttons {
            display: flex;
            justify-content: space-around;
            gap: 10px;
        }

        button {
            background: linear-gradient(180deg, var(--emerald) 0%, #003319 100%);
            color: var(--gold);
            border: 1px solid var(--gold);
            padding: 12px 25px;
            cursor: pointer;
            font-family: 'Cinzel', serif;
            text-transform: uppercase;
            letter-spacing: 2px;
            transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            border-radius: 4px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
        }

        button:hover {
            background: var(--gold);
            color: var(--deep-black);
            box-shadow: 0 0 25px var(--gold);
            transform: translateY(-2px);
        }

        button:active {
            transform: translateY(1px);
        }

        .mischief-result {
            margin-top: 15px;
            font-weight: bold;
            min-height: 24px;
        }

        @keyframes ready-pulse {
            0% {
                text-shadow: 0 0 5px #00ff41;
                color: #00ff41;
            }

            50% {
                text-shadow: 0 0 15px #00ff41, 0 0 25px #00ff41;
                color: #fff;
            }

            100% {
                text-shadow: 0 0 5px #00ff41;
                color: #00ff41;
            }
        }

        .ready-pulse {
            animation: ready-pulse 1.5s infinite;
        }

        .center-img-container {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 20px auto;
        }

        .center-img {
            display: block;
            margin-left: auto;
            margin-right: auto;
            image-rendering: pixelated;
        }

        .bordered-text {
            border: 2px solid yellow;
            /* Shorthand for width, style, and color */
            padding: 5px;
            /* Adds space between the text and the border */
            display: inline-block;
            /* Allows padding/margin to be applied correctly */
        }

        /* 3D Fight Modal overrides */
        .fight-content {
            background: #000;
            padding: 0;
            border: none;
            width: 100vw;
            height: 100vh;
            max-width: 100%;
            max-height: 100%;
            border-radius: 0;
            box-shadow: none;
            position: relative;
            display: flex;
            flex-direction: column;
        }

        .fight-frame {
            width: 100%;
            height: 100%;
            border: none;
            display: block;
        }


        .modal {
            display: none;
            position: fixed;
            z-index: 9999;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
        }

        .modal-content {
            background: #111;
            margin: 5% auto;
            padding: 0;
            width: 90%;
            max-width: 1000px;
            height: 80vh;
            border-radius: 12px;
            border: 2px solid yellow;
            position: relative;
        }

        .modal-content iframe {
            width: 100%;
            height: 100%;
            border: none;
            border-radius: 12px;
        }

        #credits-modal {
            z-index: 20000 !important;
            background: #000 !important;
        }

        #credits-modal .modal-content {
            width: 100vw !important;
            height: 100vh !important;
            max-width: 100vw !important;
            max-height: 100vh !important;
            margin: 0 !important;
            padding: 0 !important;
            border: none !important;
            border-radius: 0 !important;
            background: #0a0a0a !important;
            top: 0 !important;
            left: 0 !important;
            position: fixed !important;
        }

        #credits-modal iframe {
            width: 100vw !important;
            height: 100vh !important;
            border: none !important;
            display: block !important;
        }

        #credits-modal .close {
            top: 20px;
            right: 30px;
            font-size: 40px;
            z-index: 10001;
        }

        .close {
            position: absolute;
            top: 8px;
            right: 14px;
            font-size: 28px;
            color: yellow;
            cursor: pointer;
        }

        /* Notifications */
        #notification-container {
            position: fixed;
            top: 85px;
            /* Below top HUD */
            left: 50%;
            transform: translateX(-50%);
            z-index: 10000;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            pointer-events: none;
        }

        .notification {
            background: linear-gradient(135deg, #1a1a1a 0%, #051208 100%);
            color: var(--gold);
            border: 1px solid rgba(212, 175, 55, 0.5);
            padding: 15px 30px;
            border-radius: 4px;
            font-family: 'Cinzel', serif;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.2);
            animation: slideInRight 0.6s cubic-bezier(0.23, 1, 0.32, 1);
            min-width: 320px;
            text-align: center;
            backdrop-filter: blur(15px);
            border-left: 5px solid var(--gold);
            position: relative;
            overflow: hidden;
        }

        .notification::after {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
            transition: 0.5s;
            animation: shine 3s infinite;
        }

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

            20% {
                left: 100%;
            }

            100% {
                left: 100%;
            }
        }

        @keyframes slideInRight {
            from {
                transform: translateX(100%) scale(0.9);
                opacity: 0;
            }

            to {
                transform: translateX(0) scale(1);
                opacity: 1;
            }
        }

        @keyframes slideInDown {
            from {
                transform: translateY(-100%);
                opacity: 0;
            }

            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        @keyframes fadeOut {
            from {
                opacity: 1;
                transform: translateY(0);
            }

            to {
                opacity: 0;
                transform: translateY(-20px);
            }
        }

        /* Transition Overlay */
        #transition-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #000;
            z-index: 15000;
            display: none;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.8s ease;
        }

        #transition-overlay.active {
            display: flex;
            opacity: 1;
        }

        #transition-overlay h2 {
            font-size: 3em;
            color: var(--gold);
            text-shadow: 0 0 30px var(--gold);
            letter-spacing: 10px;
        }

        /* Death Screen */
        #death-screen {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: radial-gradient(circle, #300000 0%, #000 100%);
            z-index: 10001;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: #ff4141;
            text-shadow: 0 0 20px #ff0000;
        }

        #death-screen h1 {
            font-size: 5em;
            margin: 0;
            color: #ff4141;
            text-shadow: 0 0 30px #ff0000;
            letter-spacing: 15px;
        }

        #death-screen p {
            font-size: 1.8em;
            margin: 20px 0;
            color: #ccc;
            font-family: 'Cormorant Garamond', serif;
            font-style: italic;
        }

        #death-screen button {
            background: #600;
            border-color: #f00;
            color: #fff;
            margin-top: 30px;
            font-size: 1.4em;
            padding: 15px 50px;
            border: 2px solid #f00;
            border-radius: 5px;
            box-shadow: 0 0 10px #f00;
        }

        #death-screen button:hover {
            background: #f00;
            color: #000;
            box-shadow: 0 0 40px #f00;
        }

        /* Leaderboard Styles */
        #leaderboard-modal .modal-content {
            height: auto;
            max-height: 85vh;
            overflow-y: auto;
            width: 500px;
            margin: 5vh auto;
        }

        .leaderboard-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.2em;
        }

        .leaderboard-table th {
            color: var(--gold);
            border-bottom: 2px solid var(--gold);
            padding: 10px;
            text-align: left;
            text-transform: uppercase;
            font-family: 'Cinzel', serif;
        }

        .leaderboard-table td {
            padding: 12px 10px;
            border-bottom: 1px solid rgba(212, 175, 55, 0.2);
            color: #ccc;
        }

        .leaderboard-table tr:nth-child(1) td {
            color: #fff;
            text-shadow: 0 0 10px var(--gold);
            font-weight: bold;
        }

        .leaderboard-table tr:nth-child(2) td {
            color: #e5e4e2;
        }

        .leaderboard-table tr:nth-child(3) td {
            color: #cd7f32;
        }

        #score-submit-container {
            margin-top: 20px;
            display: none;
            flex-direction: column;
            align-items: center;
            gap: 15px;
            background: rgba(0, 0, 0, 0.5);
            padding: 20px;
            border: 1px solid var(--gold);
            border-radius: 10px;
            backdrop-filter: blur(5px);
        }

        #score-submit-container h3 {
            margin: 0;
            color: var(--gold);
            font-family: 'Cinzel', serif;
        }

        #score-submit-container input {
            background: #000;
            border: 1px solid var(--gold);
            color: var(--gold);
            padding: 10px;
            font-family: 'Cinzel', serif;
            text-align: center;
            font-size: 1.1em;
            outline: none;
            width: 200px;
        }

        #score-submit-container input:focus {
            box-shadow: 0 0 10px var(--gold);
        }

        @keyframes floating {
            0% {
                transform: translateY(0px);
            }

            50% {
                transform: translateY(-15px);
            }

            100% {
                transform: translateY(0px);
            }
        }

        @keyframes splash-pulse {
            0% {
                transform: scale(1) rotate(-15deg);
            }

            50% {
                transform: scale(1.1) rotate(-15deg);
            }

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

        .splash-text {
            position: absolute;
            top: 60px;
            right: -80px;
            color: #ffff00;
            font-size: 1.2rem;
            font-family: 'Cinzel', serif;
            text-shadow: 2px 2px 0px #3f3f00;
            animation: splash-pulse 0.5s ease-in-out infinite;
            z-index: 100;
            white-space: nowrap;
            pointer-events: none;
            -webkit-user-select: none;
            user-select: none;
            font-weight: bold;
        }

        .ticker-container {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background: rgba(5, 18, 8, 0.9);
            backdrop-filter: blur(20px);
            border-top: 2px solid rgba(212, 175, 55, 0.4);
            z-index: 1000;
            overflow: hidden;
            height: 35px;
            display: flex;
            align-items: center;
            box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.5);
        }


        .ticker-wrap {
            width: 100%;
            display: flex;
            justify-content: center;
        }

        .ticker-move {
            display: flex;
            justify-content: center;
            width: 100%;
        }

        .ticker-item {
            padding: 0 1rem;
            font-family: 'Cinzel', serif;
            font-size: 1rem;
            color: var(--gold);
            text-transform: uppercase;
            letter-spacing: 2px;
            text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
        }

        /* Time Warp Animation */
        @keyframes timeWarpEffect {
            0% {
                transform: scale(0.5) rotate(0deg);
                opacity: 0;
            }

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



        @keyframes screenVibrate {
            0% {
                transform: translate(0, 0);
            }

            25% {
                transform: translate(10px, -10px);
            }

            50% {
                transform: translate(-10px, 10px);
            }

            75% {
                transform: translate(10px, 10px);
            }

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

        .time-warp-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            z-index: 30000;
            pointer-events: none;
            background: rgba(0, 0, 0, 0.9);
            display: none;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 40px;
            box-sizing: border-box;
            text-align: center;
        }

        .time-warp-overlay.active {
            display: flex;
            pointer-events: auto;
            animation: timeWarpEffect 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
        }

        .punishment-text {
            color: #ff4141;
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.4em;
            font-style: italic;
            line-height: 1.5;
            max-width: 800px;
            text-shadow: 0 0 10px #ff0000, 0 0 20px #000;
            opacity: 1;
            transform: translateY(0);
            /* Slower fade in removed */
        }

        .punishment-title {
            color: var(--gold);
            font-family: 'Cinzel', serif;
            font-size: 2.2em;
            margin-bottom: 25px;
            letter-spacing: 8px;
            text-shadow: 0 0 20px var(--gold);
            opacity: 1;
        }

        .time-warp-overlay.active .punishment-text,
        .time-warp-overlay.active .punishment-title {
            opacity: 1;
            transform: translateY(0);
        }

        .vibrate-container {
            animation: screenVibrate 0.1s infinite;
        }

        #transition-overlay.active {
            pointer-events: auto;
        }

        #transition-overlay #transition-realm-desc,
        #transition-overlay #transition-realm-name,
        #transition-overlay h2,
        #transition-overlay p {
            opacity: 1;
            transition: opacity 1s ease;
        }

        .continue-btn {
            margin-top: 30px;
            padding: 15px 40px;
            font-size: 1.2em;
            letter-spacing: 5px;
            opacity: 0;
            display: none;
            transform: scale(0.8);
            transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            pointer-events: none;
            z-index: 30001;
        }

        .continue-btn.visible {
            display: block;
            opacity: 1;
            transform: scale(1);
            pointer-events: auto;
        }