* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            height: 100vh;
            overflow: hidden;
            touch-action: none;
        }

        #gameContainer {
            position: relative;
            width: 100%;
            height: 100%;
            display: flex;
        }

        #gameCanvas {
            flex: 1;
            cursor: grab;
            image-rendering: pixelated;
            touch-action: none;
        }

        #gameCanvas:active {
            cursor: grabbing;
        }

        #ui {
            position: absolute;
            top: 10px;
            left: 10px;
            z-index: 100;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .stat-card {
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 12px;
            padding: 12px;
            color: white;
            font-size: 13px;
            min-width: 160px;
            transition: all 0.3s ease;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        }

        .stat-card:hover {
            background: rgba(255, 255, 255, 0.25);
            transform: translateY(-2px);
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
        }

        .stat-row {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .stat-row:last-child {
            margin-bottom: 0;
        }

        .stat-value {
            font-weight: 600;
            color: #4ade80;
        }

        .progress-bar {
            width: 100%;
            height: 6px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            overflow: hidden;
            margin-top: 5px;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #4ade80, #22c55e);
            transition: width 0.3s ease;
        }

        .npc-panel {
            position: absolute;
            top: 10px;
            right: 10px;
            background: rgba(0, 0, 0, 0.8);
            border-radius: 12px;
            padding: 15px;
            color: white;
            font-size: 11px;
            width: 200px;
            max-height: 350px;
            overflow-y: auto;
            z-index: 100;
            display: none;
        }

        .npc-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 15px;
        }

        .npc-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #667eea;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
        }

        .npc-info h3 {
            margin: 0;
            font-size: 16px;
            color: #4ade80;
        }

        .npc-info p {
            margin: 0;
            color: #888;
            font-size: 11px;
        }

        .need-bar {
            margin-bottom: 8px;
        }

        .need-label {
            display: flex;
            justify-content: space-between;
            font-size: 10px;
            margin-bottom: 2px;
        }

        .need-progress {
            height: 4px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 2px;
            overflow: hidden;
        }

        .need-fill {
            height: 100%;
            transition: width 0.3s ease;
        }

        .need-fill.hunger { background: #ef4444; }
        .need-fill.sleep { background: #3b82f6; }
        .need-fill.safety { background: #f59e0b; }
        .need-fill.social { background: #8b5cf6; }
        .need-fill.morale { background: #10b981; }

        #console {
            position: absolute;
            bottom: 10px;
            left: 10px;
            right: 10px;
            height: 120px;
            background: rgba(0, 0, 0, 0.8);
            border-radius: 8px;
            padding: 12px;
            color: #00ff00;
            font-family: 'Courier New', monospace;
            font-size: 11px;
            overflow-y: auto;
            z-index: 100;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        #console::-webkit-scrollbar {
            width: 6px;
        }

        #console::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
        }

        #console::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.3);
            border-radius: 3px;
        }

        .controls {
            position: absolute;
            top: 10px;
            right: 220px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .control-row {
            display: flex;
            gap: 10px;
        }

        .control-btn {
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            width: 44px;
            height: 44px;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            font-size: 18px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
            touch-action: manipulation;
        }

        .control-btn:hover {
            background: rgba(255, 255, 255, 0.25);
            transform: scale(1.1);
            box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
        }

        .control-btn.active {
            background: rgba(77, 222, 128, 0.3);
            border-color: #4ade80;
        }

        .mini-map {
            position: absolute;
            bottom: 140px;
            right: 10px;
            width: 160px;
            height: 120px;
            background: rgba(0, 0, 0, 0.8);
            border-radius: 8px;
            border: 2px solid rgba(255, 255, 255, 0.2);
            overflow: hidden;
            backdrop-filter: blur(10px);
        }

        #miniCanvas {
            width: 100%;
            height: 100%;
        }

        .spectator-panel {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.9);
            border-radius: 15px;
            padding: 30px;
            color: white;
            text-align: center;
            z-index: 200;
            display: none;
        }

        .spectator-panel h2 {
            margin-bottom: 20px;
            color: #4ade80;
        }

        .spectator-options {
            display: flex;
            gap: 15px;
            justify-content: center;
            margin-top: 20px;
        }

        .spectator-btn {
            background: rgba(77, 222, 128, 0.2);
            border: 1px solid #4ade80;
            border-radius: 8px;
            padding: 10px 20px;
            color: white;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .spectator-btn:hover {
            background: rgba(77, 222, 128, 0.3);
        }

        .time-controls {
            display: flex;
            gap: 5px;
            margin-top: 10px;
        }

        .time-btn {
            background: rgba(255, 255, 255, 0.15);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            padding: 6px 8px;
            color: white;
            cursor: pointer;
            font-size: 11px;
            transition: all 0.3s ease;
            touch-action: manipulation;
        }

        .time-btn:hover {
            background: rgba(255, 255, 255, 0.25);
        }

        .time-btn.active {
            background: rgba(77, 222, 128, 0.3);
            border-color: #4ade80;
        }

        /* Mobile optimizations */
        @media (max-width: 768px) {
            #ui {
                top: 5px;
                left: 5px;
                gap: 8px;
            }
            
            .stat-card {
                min-width: 140px;
                padding: 8px;
                font-size: 11px;
                border-radius: 8px;
            }
            
            #console {
                height: 80px;
                bottom: 5px;
                left: 5px;
                right: 5px;
                font-size: 10px;
                padding: 8px;
            }
            
            .controls {
                top: 5px;
                right: 5px;
                gap: 6px;
            }
            
            .control-btn {
                width: 36px;
                height: 36px;
                font-size: 14px;
            }
            
            .mini-map {
                bottom: 90px;
                right: 5px;
                width: 120px;
                height: 90px;
            }
            
            .npc-panel {
                top: 5px;
                right: 5px;
                width: 160px;
                max-height: 250px;
                padding: 10px;
                font-size: 10px;
            }
            
            .time-btn {
                padding: 4px 6px;
                font-size: 10px;
            }
        }

        /* Touch feedback */
        .control-btn:active,
        .time-btn:active {
            transform: scale(0.95);
            background: rgba(255, 255, 255, 0.3);
        }

        /* Mobile landscape adjustments */
        @media (max-width: 768px) and (orientation: landscape) {
            #ui {
                flex-direction: row;
                flex-wrap: wrap;
            }
            
            .stat-card {
                min-width: 120px;
                padding: 6px;
                font-size: 10px;
            }
            
            #console {
                height: 60px;
                font-size: 9px;
            }
        }
        
        #dayNightOverlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 50;
            transition: opacity 0.5s ease;
        }

        .event-notification {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.9);
            border: 2px solid #ef4444;
            border-radius: 12px;
            padding: 20px;
            color: white;
            text-align: center;
            z-index: 150;
            display: none;
            animation: eventPulse 2s ease-in-out;
        }

        @keyframes eventPulse {
            0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
            50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
            100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
        }

        .event-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 10px;
            color: #ef4444;
        }

        .event-description {
            font-size: 14px;
            color: #ccc;
        }

        .time-display {
            background: rgba(0, 0, 0, 0.8);
            border-radius: 8px;
            padding: 8px 12px;
            color: white;
            font-size: 12px;
            margin-top: 5px;
        }

        .divine-panel {
            position: absolute;
            top: 10px;
            left: 220px;
            background: rgba(0, 0, 0, 0.9);
            border-radius: 12px;
            padding: 15px;
            color: white;
            font-size: 12px;
            width: 250px;
            max-height: 400px;
            overflow-y: auto;
            z-index: 100;
            display: none;
            backdrop-filter: blur(10px);
            border: 2px solid #ffd700;
        }

.divine-builds {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    margin-top: 10px;
}

.divine-builds button {
    padding: 5px;
    background: #2d3748;
    border: 1px solid #4a5568;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.divine-builds button:hover:not(.disabled) {
    background: #4a5568;
}

.divine-builds button.active {
    background: #4c51bf;
}

        .divine-header {
            text-align: center;
            margin-bottom: 15px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.3);
            padding-bottom: 10px;
        }

        .divine-header h3 {
            margin: 0 0 10px 0;
            color: #ffd700;
            font-size: 16px;
        }

        .faith-display {
            display: flex;
            justify-content: space-between;
            margin-bottom: 5px;
        }

        .divine-alignment {
            font-size: 11px;
            color: #888;
        }

        .divine-section {
            margin-bottom: 15px;
        }

        .divine-section h4 {
            margin: 0 0 10px 0;
            font-size: 13px;
            color: #4ade80;
        }

        .divine-action {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px;
            margin-bottom: 5px;
            background: rgba(77, 222, 128, 0.1);
            border: 1px solid rgba(77, 222, 128, 0.3);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .divine-action:hover {
            background: rgba(77, 222, 128, 0.2);
            border-color: #4ade80;
        }

        .divine-action.wrath {
            background: rgba(239, 68, 68, 0.1);
            border-color: rgba(239, 68, 68, 0.3);
        }

        .divine-action.wrath:hover {
            background: rgba(239, 68, 68, 0.2);
            border-color: #ef4444;
        }

        .divine-action.disabled {
            opacity: 0.5;
            cursor: not-allowed;
            background: rgba(100, 100, 100, 0.1);
            border-color: rgba(100, 100, 100, 0.3);
        }

        .cost {
            font-size: 10px;
            color: #ffd700;
        }