body {
            margin: 0;
            overflow: hidden;
            font-family: 'Segoe UI', sans-serif;
            user-select: none;
            overscroll-behavior: none;
            -webkit-overflow-scrolling: touch;
        }

        #crosshair {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 10px;
            height: 10px;
            border: 2px solid white;
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            mix-blend-mode: difference;
            z-index: 10;
        }

        #timer {
            position: absolute;
            top: 20px;
            left: 20px;
            color: white;
            background: rgba(0,0,0,0.7);
            padding: 10px 20px;
            border-radius: 10px;
            font-size: 24px;
            font-weight: bold;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
            pointer-events: none;
            z-index: 5;
            display: none;
        }

        #stats {
            position: absolute;
            top: 80px;
            left: 20px;
            color: white;
            background: rgba(0,0,0,0.5);
            padding: 15px;
            border-radius: 10px;
            pointer-events: none;
        }

        .currency-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 5px 0;
            font-size: 1.2em;
            font-weight: bold;
        }

        .currency-icon {
            width: 20px;
            height: 20px;
            border-radius: 3px;
            image-rendering: pixelated;
        }

        #item-name-overlay {
            position: absolute;
            bottom: 165px;
            left: 50%;
            transform: translateX(-50%);
            color: #fff;
            font-size: 24px;
            font-weight: 600;
            text-shadow: 0px 2px 4px rgba(0,0,0,0.8);
            opacity: 0;
            transition: opacity 0.5s ease-in-out;
            pointer-events: none;
            z-index: 15;
        }

        #break-progress {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, 20px);
            width: 200px;
            height: 20px;
            background: rgba(0,0,0,0.7);
            border: 2px solid white;
            border-radius: 4px;
            display: none;
            overflow: hidden;
        }

        #break-progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #4d9043, #7bc96f);
            width: 0%;
            transition: width 0.1s linear;
        }

        #eat-progress {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, 20px);
            width: 200px;
            height: 20px;
            background: rgba(0,0,0,0.7);
            border: 2px solid white;
            border-radius: 4px;
            display: none;
            overflow: hidden;
        }

        #eat-progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #ffffff, #ffddaa);
            width: 0%;
            transition: width 0.1s linear;
        }

        #hotbar-container {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 8px;
            background: rgba(0, 0, 0, 0.3);
            padding: 10px;
            border-radius: 8px;
        }

        #inventory-screen {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(16, 16, 16, 0.95);
            color: white;
            padding: 30px;
            border-radius: 15px;
            display: none;
            text-align: center;
            border: 2px solid #555;
            z-index: 20;
            box-shadow: 0 0 20px rgba(0,0,0,0.8);
        }

        #inventory-screen h2 {
            margin: 0 0 20px 0;
            font-size: 28px;
        }

        .inventory-grid {
            display: grid;
            grid-template-columns: repeat(9, 60px);
            gap: 8px;
            margin-bottom: 20px;
        }

        .inventory-slot {
            width: 60px;
            height: 60px;
            background: rgba(0, 0, 0, 0.6);
            border: 3px solid #444;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 12px;
            cursor: grab;
            transition: all 0.1s;
        }

        .inventory-slot:hover {
            border-color: #666;
            background: rgba(50, 50, 50, 0.7);
        }

        .inventory-slot.dragging {
            opacity: 0.5;
            cursor: grabbing;
        }

        .inventory-slot.drag-over {
            border-color: white;
            background: rgba(100, 100, 100, 0.8);
        }

        .inventory-slot img {
            width: 40px;
            height: 40px;
            image-rendering: pixelated;
            pointer-events: none;
        }

        .inv-slot {
            width: 50px;
            height: 50px;
            background: rgba(0, 0, 0, 0.6);
            border: 3px solid #444;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 12px;
            cursor: pointer;
        }

        .inv-slot.active {
            border-color: white;
            transform: scale(1.1);
            background: rgba(50, 50, 50, 0.8);
        }

        .slot-count {
            position: absolute;
            bottom: 2px;
            right: 4px;
            font-size: 14px;
            text-shadow: 1px 1px 0 #000;
        }

        .slot-key {
            position: absolute;
            top: 2px;
            left: 4px;
            font-size: 10px;
            color: #aaa;
        }

        #shop {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(16, 16, 16, 0.95);
            color: white;
            padding: 30px;
            border-radius: 15px;
            display: none;
            text-align: center;
            border: 2px solid #555;
            min-width: 450px;
            max-height: 80vh;
            overflow-y: auto;
            z-index: 20;
            box-shadow: 0 0 20px rgba(0,0,0,0.8);
        }
        
        #shop::-webkit-scrollbar {
            width: 10px;
        }
        
        #shop::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.3);
            border-radius: 5px;
        }
        
        #shop::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.3);
            border-radius: 5px;
        }
        
        #shop::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.5);
        }

        #settings {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(16, 16, 16, 0.95);
            color: white;
            padding: 30px;
            border-radius: 15px;
            display: none;
            text-align: center;
            border: 2px solid #555;
            min-width: 400px;
            z-index: 20;
            box-shadow: 0 0 20px rgba(0,0,0,0.8);
        }

        /* Account section in settings */
        #account-section {
            margin-top: 20px;
            border-top: 1px solid #444;
            padding-top: 18px;
        }
        #account-section h3 {
            margin: 0 0 14px 0;
            font-size: 15px;
            color: #ccc;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        .account-btn {
            padding: 9px 20px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            margin: 4px;
            transition: background 0.15s;
        }
        #btn-login { background: #2a6db5; color: white; }
        #btn-login:hover { background: #3585d4; }
        #btn-register { background: #1a7a3a; color: white; }
        #btn-register:hover { background: #22a04d; }
        #btn-signout { background: #8b2222; color: white; }
        #btn-signout:hover { background: #b83232; }
        #account-info {
            font-size: 13px;
            color: #aaa;
            margin-bottom: 8px;
        }
        #account-stats {
            font-size: 12px;
            color: #888;
            margin-top: 4px;
        }

        /* Auth modal */
        #auth-modal {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(16,16,16,0.97);
            color: white;
            padding: 30px 36px;
            border-radius: 15px;
            border: 2px solid #555;
            z-index: 1100;
            min-width: 320px;
            display: none;
            box-shadow: 0 0 30px rgba(0,0,0,0.9);
        }
        #auth-modal h2 { margin: 0 0 20px 0; font-size: 20px; }
        .auth-input {
            width: 100%;
            box-sizing: border-box;
            padding: 10px 12px;
            margin: 7px 0;
            background: #2a2a2a;
            border: 1px solid #555;
            border-radius: 6px;
            color: white;
            font-size: 14px;
        }
        .auth-input:focus { outline: none; border-color: #888; }
        #auth-submit {
            width: 100%;
            margin-top: 14px;
            padding: 11px;
            border: none;
            border-radius: 6px;
            background: #2a6db5;
            color: white;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
        }
        #auth-submit:hover { background: #3585d4; }
        #auth-cancel {
            width: 100%;
            margin-top: 8px;
            padding: 9px;
            border: 1px solid #555;
            border-radius: 6px;
            background: transparent;
            color: #aaa;
            font-size: 14px;
            cursor: pointer;
        }
        #auth-cancel:hover { background: #222; color: white; }
        #auth-error {
            color: #e05555;
            font-size: 13px;
            margin-top: 8px;
            min-height: 18px;
        }


        .settings-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: 20px 0;
            padding: 15px;
            background: rgba(255,255,255,0.05);
            border-radius: 8px;
        }

        .settings-label {
            font-size: 16px;
            font-weight: 500;
        }

        .settings-value {
            font-size: 14px;
            color: #aaa;
            margin-left: 20px;
        }

        .settings-slider {
            width: 200px;
            height: 6px;
            -webkit-appearance: none;
            appearance: none;
            background: #555;
            outline: none;
            border-radius: 3px;
        }

        .settings-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            background: white;
            cursor: pointer;
            border-radius: 50%;
        }

        .settings-slider::-moz-range-thumb {
            width: 20px;
            height: 20px;
            background: white;
            cursor: pointer;
            border-radius: 50%;
            border: none;
        }

        .shop-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
            margin-top: 15px;
        }

        .shop-item {
            padding: 15px;
            border: 1px solid #444;
            cursor: pointer;
            background: #222;
            transition: 0.2s;
        }

        .shop-item:hover {
            background: #333;
            border-color: #fff;
        }

        .shop-item:active {
            background: #444;
        }

        .shop-item.disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .block-icon {
            width: 30px;
            height: 30px;
            border: 1px solid rgba(255,255,255,0.3);
            image-rendering: auto;
        }

        .shop-icon {
            width: 48px;
            height: 48px;
            image-rendering: pixelated;
            margin: 0 auto 10px;
            border: 2px solid rgba(255,255,255,0.2);
            border-radius: 4px;
        }

        #controls-hint {
            position: absolute;
            top: 20px;
            right: 20px;
            color: #ccc;
            font-size: 12px;
            text-align: right;
            text-shadow: 1px 1px 2px black;
        }

        #class-hint {
            position: absolute;
            top: 20px;
            right: 20px;
            color: #ccc;
            font-size: 12px;
            font-weight: normal;
            text-align: right;
            text-shadow: 1px 1px 2px black;
            display: none;
            pointer-events: none;
        }

        #spectator-controls-hint {
            position: absolute;
            top: 38px;
            right: 20px;
            color: #ccc;
            font-size: 12px;
            font-weight: normal;
            text-align: right;
            text-shadow: 1px 1px 2px black;
            pointer-events: none;
        }

        #queue-display {
            position: absolute;
            top: 80px;
            left: 20px;
            color: #ffdd55;
            font-size: 15px;
            font-weight: bold;
            text-shadow: 1px 1px 3px black;
            background: rgba(0,0,0,0.55);
            padding: 8px 14px;
            border-radius: 8px;
            display: none;
            pointer-events: none;
            z-index: 15;
        }

        .crouch-indicator {
            color: #ffff88 !important;
        }

        #loading {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #000;
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            z-index: 100;
        }

        #notification {
            position: absolute;
            top: 10%;
            left: 50%;
            transform: translateX(-50%);
            color: white;
            font-size: 30px;
            text-shadow: 2px 2px 4px black;
            background: rgba(0,0,0,0.5);
            padding: 10px 20px;
            border-radius: 10px;
            display: none;
            z-index: 15;
        }

        #respawn-timer {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 30px;
            font-weight: normal;
            text-shadow: 2px 2px 4px black;
            background: rgba(0,0,0,0.5);
            padding: 10px 20px;
            border-radius: 10px;
            display: none;
            z-index: 25;
            text-align: center;
            pointer-events: none;
        }

        #health-display {
            position: absolute;
            bottom: 100px;
            left: 50%;
            transform: translateX(-50%);
            display: none;
            z-index: 10;
        }
        
        .health-row {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .health-icon {
            width: 32px;
            height: 32px;
            image-rendering: auto;
            filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.8));
        }
        
        .health-icon.low-health {
            animation: heartShake 0.4s infinite;
        }
        
        @keyframes heartShake {
            0%, 100% {
                transform: translateY(0);
            }
            25% {
                transform: translateY(-5px);
            }
            75% {
                transform: translateY(5px);
            }
        }


        #overheat-display {
            position: absolute;
            bottom: 135px;
            left: 50%;
            transform: translateX(-50%);
            display: none;
            pointer-events: none;
        }

        #overheat-label {
            color: #ffcc66;
            font-size: 21px;
            font-weight: bold;
            text-align: center;
            text-shadow: 1px 1px 3px black, 0 0 8px rgba(0,0,0,0.8);
            letter-spacing: 1px;
            white-space: nowrap;
        }
        
        #generator-upgrade-ui {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(16, 16, 16, 0.95);
            color: white;
            padding: 20px 30px;
            border-radius: 10px;
            display: none;
            text-align: center;
            border: 2px solid #555;
            z-index: 25;
            min-width: 300px;
        }
        
        #generator-upgrade-ui h3 {
            margin: 0 0 15px 0;
            font-size: 20px;
            color: #ffd700;
        }
        
        #generator-upgrade-ui .upgrade-option {
            margin: 10px 0;
            padding: 10px;
            background: rgba(50, 50, 50, 0.8);
            border: 2px solid #666;
            border-radius: 5px;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        #generator-upgrade-ui .upgrade-option:hover {
            background: rgba(70, 70, 70, 0.9);
            border-color: #ffd700;
            transform: scale(1.02);
        }
        
        #generator-upgrade-ui .upgrade-option.disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        
        #generator-upgrade-ui .upgrade-option.disabled:hover {
            background: rgba(50, 50, 50, 0.8);
            border-color: #666;
            transform: none;
        }
        
        #generator-upgrade-ui .upgrade-cost {
            color: #ffd700;
            font-weight: bold;
        }
        
        #generator-upgrade-ui .upgrade-benefit {
            color: #aaa;
            font-size: 14px;
            margin-top: 5px;
        }
        
        #class-selector {
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(16, 16, 16, 0.95);
            color: white;
            padding: 18px 24px;
            border-radius: 15px;
            display: none;
            text-align: center;
            border: 2px solid #555;
            z-index: 20;
            box-shadow: 0 0 20px rgba(0,0,0,0.8);
            min-width: 560px;
        }

        #class-selector h3 {
            margin: 0 0 12px 0;
            font-size: 16px;
            color: #ccc;
            letter-spacing: 2px;
            text-transform: uppercase;
        }



        .class-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 8px;
        }

        .class-section-label {
            font-size: 11px;
            font-weight: bold;
            color: #666;
            letter-spacing: 2px;
            text-transform: uppercase;
            margin-bottom: 8px;
        }

        .class-item {
            padding: 10px 8px;
            border: 2px solid #444;
            cursor: pointer;
            background: #1a1a1a;
            border-radius: 8px;
            transition: 0.15s;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
        }

        .class-item:hover {
            background: #2a2a2a;
            border-color: #888;
        }

        .class-item.selected-blue   { border-color: #4499ff; box-shadow: 0 0 10px rgba(68,153,255,0.4); }
        .class-item.selected-brown  { border-color: #a86e34; box-shadow: 0 0 10px rgba(168,110,52,0.4); }
        .class-item.selected-green  { border-color: #44cc44; box-shadow: 0 0 10px rgba(68,204,68,0.4); }
        .class-item.selected-purple { border-color: #aa44ff; box-shadow: 0 0 10px rgba(170,68,255,0.4); }
        .class-item.selected-amber  { border-color: #ff9900; box-shadow: 0 0 10px rgba(255,153,0,0.4); }
        .class-item.selected-ghost  { border-color: #aaaacc; box-shadow: 0 0 10px rgba(170,170,204,0.4); }
        .class-item.selected-black  { border-color: #333333; box-shadow: 0 0 10px rgba(0,0,0,0.6); }
        .class-item.selected-crimson { border-color: #cc0000; box-shadow: 0 0 10px rgba(204,0,0,0.6); }
        .class-item.selected-red    { border-color: #ff2222; box-shadow: 0 0 10px rgba(255,34,34,0.6); }

        .class-item.locked {
            cursor: not-allowed;
            opacity: 0.65;
            border-color: #555;
            position: relative;
        }
        .class-item.locked:hover {
            background: #1a1a1a;
            border-color: #666;
        }
        .class-item.locked .class-eye-icon {
            filter: grayscale(0.5) brightness(0.7);
        }
        .class-locked-badge {
            font-size: 10px;
            font-weight: bold;
            color: #ff9944;
            letter-spacing: 1px;
            text-transform: uppercase;
        }
        .class-unlock-hint {
            font-size: 11px;
            color: #888;
            font-style: italic;
            margin-top: 2px;
        }

        .class-eye-icon {
            width: 48px;
            height: 48px;
            image-rendering: pixelated;
            border-radius: 4px;
        }

        .class-name {
            font-size: 12px;
            font-weight: bold;
            color: #eee;
        }

        .class-desc {
            font-size: 10px;
            color: #999;
            line-height: 1.3;
            text-align: center;
        }

        #spectator-indicator {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: #ff5555;
            font-size: 32px;
            font-weight: bold;
            text-shadow: 0 0 10px rgba(255,85,85,0.7);
            background: rgba(0,0,0,0.7);
            padding: 20px 40px;
            border-radius: 15px;
            display: none;
            z-index: 20;
            pointer-events: none;
        }

        #waiting-message {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: #ffff88;
            font-size: 28px;
            font-weight: bold;
            text-shadow: 0 0 10px rgba(255,255,136,0.7);
            background: rgba(0,0,0,0.8);
            padding: 20px 40px;
            border-radius: 15px;
            display: none;
            z-index: 20;
            pointer-events: none;
        }
        
        #fullscreen-overlay {
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.55);
            backdrop-filter: blur(2px);
            -webkit-backdrop-filter: blur(2px);
            z-index: 999;
            overflow-y: auto;
            overscroll-behavior: contain;
            font-family: 'Segoe UI', system-ui, sans-serif;
            display: flex;
            align-items: center;
            justify-content: center;
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
            box-sizing: border-box;
        }

        #landing-page {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
            box-sizing: border-box;
            min-height: 100vh;
        }

        .landing-inner {
            width: 100%;
            max-width: 860px;
        }

        /* Header */
        .landing-header {
            text-align: center;
            margin-bottom: 28px;
        }

        .landing-title {
            font-size: clamp(1.8rem, 5vw, 2.8rem);
            font-weight: 700;
            color: #fff;
            margin: 0;
            text-shadow: 0 2px 8px rgba(0,0,0,0.8);
            letter-spacing: 0.02em;
            display: inline;
        }

        .landing-subtitle {
            font-size: clamp(1.8rem, 5vw, 2.8rem);
            font-weight: 700;
            color: #fff;
            text-shadow: 0 2px 8px rgba(0,0,0,0.8);
            display: inline;
            margin-left: 0.4em;
        }

        /* Main grid layout */
        .landing-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        @media (max-width: 600px) {
            .landing-grid { grid-template-columns: 1fr; }
        }

        /* Cards */
        .landing-card {
            background: rgba(0, 0, 0, 0.65);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 10px;
            padding: 20px;
            color: white;
        }

        .card-label {
            font-size: 0.68rem;
            font-weight: 600;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: rgba(255,255,255,0.4);
            margin-bottom: 14px;
        }

        /* PLAY CARD */
        .play-card {
            grid-column: 1 / -1;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 28px 20px;
            text-align: center;
        }

        #play-btn {
            background: #3cba54;
            border: none;
            color: #fff;
            font-size: 1.35rem;
            font-weight: 700;
            font-family: inherit;
            padding: 18px 80px;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.15s, transform 0.1s;
            letter-spacing: 0.03em;
        }

        #play-btn:hover { background: #34a84b; }
        #play-btn:active { transform: scale(0.97); }

        .play-hint {
            margin-top: 8px;
            font-size: 0.72rem;
            color: rgba(255,255,255,0.3);
        }

        /* ACCOUNT CARD */
        .landing-acct-guest, .landing-acct-loggedin {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .landing-acct-info {
            font-size: 0.82rem;
            color: rgba(255,255,255,0.5);
        }

        .landing-acct-name {
            font-size: 1rem;
            font-weight: 600;
            color: #fff;
        }

        .landing-stats-row {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            margin: 6px 0;
        }

        .landing-stat {
            background: rgba(255,255,255,0.06);
            border-radius: 6px;
            padding: 7px 4px;
            text-align: center;
        }

        .landing-stat-val {
            font-size: 1rem;
            font-weight: 700;
            color: #fff;
        }

        .landing-stat-key {
            font-size: 0.58rem;
            color: rgba(255,255,255,0.4);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .landing-acct-btns {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .landing-btn {
            padding: 8px 14px;
            border-radius: 6px;
            border: 1px solid rgba(255,255,255,0.15);
            background: rgba(255,255,255,0.08);
            color: rgba(255,255,255,0.8);
            font-family: inherit;
            font-size: 0.78rem;
            cursor: pointer;
            transition: background 0.15s;
        }

        .landing-btn:hover { background: rgba(255,255,255,0.15); }
        .landing-btn-signout:hover { background: rgba(180,40,40,0.4); }

        /* EYE GRID */
        .eye-grid-landing {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
        }

        .eye-item-landing {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            padding: 10px 6px;
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.15s;
            background: rgba(255,255,255,0.04);
        }

        .eye-item-landing:hover { background: rgba(255,255,255,0.1); }

        .eye-item-landing.selected-eye {
            border-color: rgba(255,255,255,0.35);
            background: rgba(255,255,255,0.1);
        }

        .eye-item-landing.locked-eye {
            opacity: 0.35;
            cursor: not-allowed;
        }

        /* Locked overlay for landing cards — applied via JS when a round is active */
        .landing-card-locked {
            position: relative;
            pointer-events: none;
            user-select: none;
        }
        .landing-card-locked::after {
            content: '🔒';
            position: absolute;
            inset: 0;
            background: rgba(0,0,0,0.6);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.6rem;
            pointer-events: all;
            cursor: not-allowed;
            z-index: 10;
        }

        .eye-img-landing {
            width: 34px;
            height: 34px;
            image-rendering: pixelated;
        }

        .eye-name-landing {
            font-size: 0.6rem;
            text-align: center;
            color: rgba(255,255,255,0.7);
        }

        .eye-lock-badge {
            font-size: 0.55rem;
            color: rgba(255,255,255,0.3);
        }

        #eye-desc-panel {
            margin-top: 8px;
            padding: 4px 2px;
            min-height: 40px;
            text-align: center;
        }

        #eye-desc-name {
            font-size: 0.75rem;
            font-weight: bold;
            margin-bottom: 4px;
        }

        #eye-desc-text {
            font-size: 0.68rem;
            color: rgba(255,255,255,0.65);
            line-height: 1.4;
        }

        #eye-desc-unlock {
            font-size: 0.65rem;
            color: #ff9944;
            margin-top: 4px;
            font-style: italic;
        }

        /* DISCORD */
        .discord-card {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            gap: 12px;
        }

        .discord-blurb {
            font-size: 0.78rem;
            color: rgba(255,255,255,0.45);
            line-height: 1.5;
        }

        #discord-join-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            padding: 11px;
            background: #5865F2;
            border-radius: 8px;
            color: white;
            text-decoration: none;
            font-family: inherit;
            font-size: 0.85rem;
            font-weight: 600;
            transition: background 0.15s;
        }

        #discord-join-btn:hover { background: #4752C4; }

        .discord-member-count {
            font-size: 0.65rem;
            color: rgba(255,255,255,0.3);
            text-align: center;
        }

        .online-dot {
            display: inline-block;
            width: 6px; height: 6px;
            background: #3cba54;
            border-radius: 50%;
            margin-right: 5px;
        }

        .health-bar {
            position: absolute;
            top: -20px;
            left: 50%;
            transform: translateX(-50%);
            width: 40px;
            height: 4px;
            background: rgba(0,0,0,0.5);
            border-radius: 2px;
            overflow: hidden;
        }

        .health-fill {
            height: 100%;
            background: #4CAF50;
            width: 100%;
            transition: width 0.3s ease;
        }

        /* Chat System Styles */
        #chat-container {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 300px;
            max-height: 400px;
            background: rgba(0, 0, 0, 0.7);
            border-radius: 10px;
            overflow: hidden;
            display: none;
            z-index: 25;
            pointer-events: none;
        }

        #chat-messages {
            height: 350px;
            overflow-y: auto;
            padding: 10px;
            font-size: 14px;
            line-height: 1.4;
            display: flex;
            flex-direction: column-reverse; /* New messages at top */
        }

        #chat-input-container {
            display: none;
            background: rgba(0, 0, 0, 0.9);
            padding: 10px;
            border-top: 1px solid #444;
        }

        #chat-input {
            width: 100%;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid #555;
            border-radius: 4px;
            color: white;
            padding: 8px;
            font-size: 14px;
            font-family: 'Segoe UI', sans-serif;
            outline: none;
        }

        #chat-input:focus {
            border-color: #4CAF50;
            background: rgba(255, 255, 255, 0.15);
        }

        .chat-message {
            margin-bottom: 8px;
            padding: 6px 8px;
            border-radius: 4px;
            background: rgba(255, 255, 255, 0.1);
            word-break: break-word;
            animation: fadeIn 0.3s ease;
        }

        .chat-message:hover {
            background: rgba(255, 255, 255, 0.15);
        }

        /* Kill feed / system messages */
        .chat-message.chat-killfeed {
            background: rgba(0, 0, 0, 0.45);
            border-left: 3px solid rgba(255, 200, 50, 0.7);
            color: #f0d080;
            font-style: italic;
            font-size: 0.88em;
            letter-spacing: 0.01em;
        }
        .chat-message.chat-killfeed:hover {
            background: rgba(0, 0, 0, 0.55);
        }

        .chat-player-name {
            font-weight: bold;
            color: #4CAF50;
            margin-right: 5px;
        }

        .chat-text {
            color: #e0e0e0;
        }
                .chat-message.own-message {
            background: rgba(255, 255, 255, 0.15);
            border-left: 3px solid #4CAF50;
        }
        
        .chat-message.own-message:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }



        #chat-toggle-hint {
            position: absolute;
            bottom: 20px;
            right: 20px;
            color: #ccc;
            font-size: 12px;
            text-align: right;
            text-shadow: 1px 1px 2px black;
            background: rgba(0, 0, 0, 0.5);
            padding: 5px 10px;
            border-radius: 4px;
        }
    
/* ═══════════════════════════════════════════════
   MOBILE CONTROLS — Roblox-style layout
   ═══════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────
   Z-INDEX LAYER MAP (mobile)
   canvas / game world       : 0
   HUD elements (crosshair)  : 10
   hotbar / health / overlays: 10-15
   look zone                 : 20   ← BELOW all menus
   joystick / action buttons : 50
   settings gear             : 60
   menus/modals              : 100+  ← bumped up so they're above look zone
   auth modal                : 1100
   ───────────────────────────────────────────────── */

/* Raise all menus/modals above the look zone on ALL screen sizes */
#shop              { z-index: 200 !important; }
#inventory-screen  { z-index: 200 !important; }
#settings          { z-index: 200 !important; }
#class-selector    { z-index: 200 !important; }
#generator-upgrade-ui { z-index: 200 !important; }
#auth-modal        { z-index: 1100 !important; }
#fullscreen-overlay { z-index: 999 !important; }
#loading           { z-index: 300 !important; }

/* ── Base mobile overrides ─────────────────────── */
/* (pointer: coarse) and (hover: none) targets true touch-primary devices only.
   Touchscreen PCs/laptops have a fine pointer (mouse) and hover support,
   so they are correctly excluded even when a touchscreen is physically present. */
@media (pointer: coarse) and (hover: none) {

    /* Hide PC-only hints */
    #controls-hint,
    #chat-toggle-hint,
    #spectator-controls-hint { display: none !important; }

    /* All HUD elements: fixed so they never drift with canvas */
    #crosshair,
    #timer,
    #stats,
    #hotbar-container,
    #health-display,
    #overheat-display,
    #item-name-overlay,
    #break-progress,
    #eat-progress,
    #notification,
    #respawn-timer,
    #spectator-indicator,
    #waiting-message,
    #queue-display { position: fixed !important; }

    /* Timer */
    #timer { top: 10px; left: 10px; font-size: 16px; padding: 6px 12px; z-index: 70; }

    /* Stats */
    #stats { top: 56px; left: 8px; padding: 8px 10px; font-size: 0.82em; z-index: 70; }

    /* ── HUD stack — centred, nudged left to clear right-side buttons ──
       Action buttons occupy bottom-right ~260px.
       Nudge left by 60px so HUD sits in the left/centre playable zone.

       Bottom stack (counting up):
         bottom: 20px  → hotbar    (~66px tall)
         bottom: 96px  → hearts    (~30px tall)
         bottom: 136px → overheat
         bottom: 168px → item name
    */
    #hotbar-container {
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(calc(-50% - 60px)) !important;
        gap: 2px !important;
        padding: 4px 5px !important;
        z-index: 70 !important;
    }
    .inv-slot {
        width: 26px !important;
        height: 26px !important;
        font-size: 8px !important;
        border-width: 2px !important;
        position: relative;
        z-index: 71;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        cursor: pointer !important;
    }

    #health-display {
        bottom: 60px !important;
        left: 50% !important;
        transform: translateX(calc(-50% - 60px)) !important;
        z-index: 70 !important;
    }
    .health-icon { width: 13px !important; height: 13px !important; }
    .health-row { gap: 2px !important; }

    #overheat-display {
        bottom: 82px !important;
        left: 50% !important;
        transform: translateX(calc(-50% - 60px)) !important;
        z-index: 70 !important;
    }
    #overheat-label { font-size: 13px !important; }

    #item-name-overlay {
        bottom: 106px !important;
        left: 50% !important;
        transform: translateX(calc(-50% - 60px)) !important;
        font-size: 15px !important;
        white-space: nowrap !important;
        z-index: 70 !important;
    }

    /* Shrink icons/text inside hotbar slots */
    .inv-slot .block-icon,
    .inv-slot img.block-icon { width: 16px !important; height: 16px !important; }
    .slot-count { font-size: 7px !important; bottom: 1px !important; right: 2px !important; }
    .slot-key   { font-size: 6px !important; }

    /* Progress bars near crosshair */
    #break-progress,
    #eat-progress {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, 24px) !important;
        z-index: 70 !important;
    }

    /* Notifications */
    #notification { font-size: 18px !important; top: 8% !important; z-index: 70 !important; }

    /* ── Menus — full width, scrollable, safe padding ── */

    /* Shop */
    #shop {
        width: 94vw !important;
        max-width: 94vw !important;
        min-width: unset !important;
        max-height: 80vh !important;
        padding: 16px !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .shop-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
    .shop-item { padding: 10px !important; }

    /* Inventory */
    #inventory-screen {
        width: 96vw !important;
        max-width: 96vw !important;
        max-height: 85vh !important;
        padding: 12px !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .inventory-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 5px !important;
    }
    .inventory-slot {
        width: 46px !important;
        height: 46px !important;
        touch-action: none !important;
        pointer-events: auto !important;
    }
    .inventory-slot img { width: 32px !important; height: 32px !important; }

    /* Settings */
    #settings {
        width: 92vw !important;
        max-width: 92vw !important;
        min-width: unset !important;
        max-height: 85vh !important;
        padding: 20px !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .settings-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    .settings-slider { width: 100% !important; }

    /* Auth modal */
    #auth-modal {
        width: 90vw !important;
        max-width: 90vw !important;
        min-width: unset !important;
        padding: 24px 20px !important;
        box-sizing: border-box !important;
    }
    .auth-input { font-size: 16px !important; } /* prevent iOS zoom on focus */

    /* Class selector */
    #class-selector {
        width: 94vw !important;
        max-width: 94vw !important;
        min-width: unset !important;
        bottom: 10px !important;
        padding: 12px 14px !important;
        box-sizing: border-box !important;
        max-height: 60vh !important;
        overflow-y: auto !important;
    }
    .class-grid { grid-template-columns: repeat(4, 1fr) !important; }
    .class-item { padding: 8px 4px !important; }
    .class-eye-icon { width: 40px !important; height: 40px !important; }

    /* Generator upgrade UI */
    #generator-upgrade-ui {
        width: 88vw !important;
        max-width: 88vw !important;
        min-width: unset !important;
        padding: 16px !important;
        box-sizing: border-box !important;
    }

    /* Chat */
    #chat-container {
        width: 85vw !important;
        right: 8px !important;
        top: 8px !important;
    }
    #chat-input { font-size: 16px !important; } /* prevent iOS zoom */

    /* Landing page */
    .landing-grid { grid-template-columns: 1fr !important; }
    .landing-stats-row { grid-template-columns: repeat(3, 1fr) !important; }
    #play-btn { padding: 16px 48px !important; font-size: 1.1rem !important; }
    .landing-inner { padding: 12px !important; }

    /* Reduce vertical whitespace throughout landing */
    #landing-page { padding: 8px !important; min-height: unset !important; align-items: flex-start !important; }
    .landing-header { margin-bottom: 12px !important; }
    .play-card { padding: 14px 12px !important; }
    .landing-card { padding: 14px !important; }
    .landing-grid { gap: 8px !important; }
    #content-section { margin-top: 16px !important; }
    .content-article { padding: 14px 14px !important; }
    .content-ad-wrap { margin: 12px 0 !important; padding: 4px !important; min-height: 60px !important; }
    .content-footer { padding: 12px 0 16px !important; }
}

/* ── Virtual Joystick (bottom-left) ───────── */
#mobile-joystick-zone {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 20px;
    width: 140px;
    height: 140px;
    z-index: 50;
    touch-action: none;
    pointer-events: auto;
}
#mobile-joystick-base {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.10);
    border: 2px solid rgba(255,255,255,0.28);
}
#mobile-joystick-knob {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.42);
    border: 2px solid rgba(255,255,255,0.75);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.45);
}

/* ── Camera look zone ─────────────────────────
   z-index: 20 — BELOW hotbar (70), menus (200),
   joystick (50), action buttons (50).
   The look zone only consumes touches when no
   UI is open (enforced in JS too).             */
#mobile-look-zone {
    display: none;
    position: fixed;
    top: 0;
    left: 180px;   /* clear the joystick */
    right: 0;
    /* Leave bottom 90px clear so hotbar touches
       pass through even if JS sync is delayed  */
    bottom: 90px;
    z-index: 20;
    touch-action: none;
    pointer-events: auto;
}

/* ── Action button cluster (bottom-right) ─── */
#mobile-action-btns {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 16px;
    width: 260px;
    height: 230px;
    z-index: 50;
    touch-action: none;
    pointer-events: none;
}

.mob-btn {
    position: absolute;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    border: 2px solid rgba(255,255,255,0.32);
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.55);
    pointer-events: auto;
    line-height: 1.1;
    transition: background 0.08s, transform 0.08s;
}
.mob-btn:active { background: rgba(255,255,255,0.28) !important; transform: scale(0.92) !important; }

/* Button positions (from bottom-right of cluster) */
#mob-jump  { width: 72px; height: 72px; right: 0;     bottom: 0;     background: rgba(70,170,70,0.7);  border-color: rgba(120,220,120,0.6); font-size: 22px; }
#mob-attack{ width: 62px; height: 62px; right: 82px;  bottom: 6px;   background: rgba(190,50,50,0.7);  border-color: rgba(255,100,100,0.55); font-size: 14px; }
#mob-build { width: 60px; height: 60px; right: 8px;   bottom: 84px;  background: rgba(50,100,200,0.7); border-color: rgba(100,160,255,0.55); font-size: 14px; }
#mob-shop  { width: 54px; height: 54px; right: 88px;  bottom: 82px;  font-size: 14px; }
#mob-crouch{ width: 54px; height: 54px; right: 156px; bottom: 10px;  font-size: 13px; }
#mob-inv   { width: 54px; height: 54px; right: 90px;  bottom: 148px; font-size: 13px; }
#mob-drop  { width: 50px; height: 50px; right: 162px; bottom: 76px;  font-size: 11px; }

/* ── Settings gear (top-right) ─────────────── */
#mob-settings-btn {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 60;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.28);
    color: white;
    font-size: 20px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

@media (pointer: coarse) and (hover: none) {
    #mob-settings-btn { display: flex; }
    #mobile-joystick-zone,
    #mobile-look-zone,
    #mobile-action-btns { display: none; } /* JS shows them when in-game */
}

/* ── Mobile close button — shown inside menus on touch devices ── */
.mobile-close-btn {
    display: none; /* hidden by default, shown on touch */
}

@media (pointer: coarse) and (hover: none) {
    .mobile-close-btn {
        display: block;
        position: absolute;
        top: 12px;
        right: 12px;
        padding: 8px 14px;
        background: rgba(200, 50, 50, 0.85);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 15px;
        font-weight: bold;
        cursor: pointer;
        z-index: 10;
        touch-action: manipulation;
        font-family: inherit;
    }
    .mobile-close-btn:active {
        background: rgba(230, 80, 80, 0.95);
    }

    /* Ensure parent menus are position:relative so the button anchors correctly */
    #shop,
    #inventory-screen,
    #settings,
    #class-selector,
    #generator-upgrade-ui {
        position: fixed !important; /* already fixed via transform, but make explicit */
    }

    /* Give menus enough top padding so close button doesn't overlap heading */
    #shop h2,
    #inventory-screen h2,
    #settings h2 { margin-top: 32px !important; }
    #class-selector h3 { margin-top: 28px !important; }
    #generator-upgrade-ui h3 { margin-top: 28px !important; }
}

/* ═══════════════════════════════════════════════════════
   PUBLISHER CONTENT SECTION
   Required alongside ads to satisfy AdSense policy:
   "ads must not appear on screens without publisher content"
   ═══════════════════════════════════════════════════════ */

#content-section {
    width: 100%;
    max-width: 860px;
    margin: 32px auto 0;
    color: rgba(255, 255, 255, 0.88);
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.content-article {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 28px 32px;
    line-height: 1.7;
}

.content-article h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 14px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.content-article h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #a8d060;
    margin: 22px 0 8px;
}

.content-article h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    margin: 18px 0 6px;
}

.content-article p {
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.92rem;
}

.content-article ul {
    margin: 0 0 14px;
    padding-left: 20px;
    color: rgba(255,255,255,0.78);
    font-size: 0.92rem;
}

.content-article ul li {
    margin-bottom: 5px;
}

.content-article strong {
    color: rgba(255,255,255,0.95);
}

.content-ad-wrap {
    margin: 20px 0;
    background: rgba(0,0,0,0.35);
    border-radius: 8px;
    padding: 8px;
    min-height: 90px;
}

.content-footer {
    text-align: center;
    padding: 20px 0 32px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.35);
}

.content-footer a {
    color: rgba(255,255,255,0.5);
    text-decoration: underline;
}

.content-footer p {
    margin: 4px 0;
}

@media (max-width: 600px) {
    .content-article {
        padding: 18px 16px;
    }
}
