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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f0f0;
    overflow: hidden;
    color: #333;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* 3D World Container */
.world {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.1s ease-out;
}

/* The 3D Plane */
.plane {
    position: absolute;
    width: 80vmin;
    height: 80vmin;
    left: 50%;
    top: 50%;
    transform-style: preserve-3d;
    transform: translate3d(-50%, -50%, 0) rotateX(60deg);
    background: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Grid pattern */
.grid {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(#e0e0e0 1px, transparent 1px),
        linear-gradient(90deg, #e0e0e0 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
    opacity: 0.6;
}

/* Center marker */
.center-marker {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Character */
.character {
    position: absolute;
    width: 30px;
    height: 40px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transform-style: preserve-3d;
    transition: transform 0.2s ease;
    z-index: 10;
}

.character-body {
    position: absolute;
    width: 20px;
    height: 30px;
    background: #4a9eff;
    border-radius: 10px 10px 8px 8px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.character-face {
    position: absolute;
    width: 12px;
    height: 8px;
    background: #ff6b9d;
    border-radius: 6px;
    left: 50%;
    top: 35%;
    transform: translate(-50%, -50%);
}

.character.moving .character-body {
    animation: characterBounce 0.3s ease-in-out infinite alternate;
}

@keyframes characterBounce {
    0% { transform: translate(-50%, -50%) scaleY(1); }
    100% { transform: translate(-50%, -52%) scaleY(0.95); }
}

/* Test objects for perspective */
.test-object {
    position: absolute;
    width: 40px;
    height: 40px;
    background: #4a9eff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    transform: translate3d(
        calc(var(--x) * 40px - 20px), 
        calc(var(--z) * 40px - 20px), 
        0px
    );
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#instructions {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#instructions div {
    margin: 5px 0;
    color: #666;
}

#debug-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-family: monospace;
    font-size: 12px;
    color: #888;
}

/* Cursor styles */
body {
    cursor: grab;
}

body.grabbing {
    cursor: grabbing;
}