body {
    background-color: #2c2f33;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    text-align: center;
    flex-direction: column;
    position: relative;
}

.user-info-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #23272a;
    border-bottom: 1px solid #2d3136;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #5865F2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    color: #ffffff;
    font-weight: 500;
}

.logout-btn {
    background-color: #4f545c;
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: background-color 0.2s;
    cursor: pointer;
    border: none;
}

.logout-btn:hover {
    background-color: #5d6269;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    max-width: 100%;
    padding: 20px;
    margin-top: 60px; /* Space for user info bar */
}

h1 {
    margin-bottom: 5px;
    font-size: 1.5rem;
}

.helper-text {
    font-size: 1rem;
    color: #c1ccd3;
    margin: 0;
}

.game-wrapper {
    position: relative;
    padding: 10px; /* Border/Frame around the game */
    background: #444; /* Dark gray frame */
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

canvas {
    background-color: #000000;
    display: block;
    border: 1px solid #333;
}

/* Gray wall simulation is done inside canvas, but wrapper gives context */

.action-btn {
    background-color: #5865F2; /* Discord Blurple */
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    width: 100%;
    max-width: 300px;
    margin-top: 10px;
}

.game-btn {
    max-width: 300px;
    margin-top: 0;
}

.canvas-btn {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 200px;
    z-index: 10;
    pointer-events: auto;
}

.action-btn:hover {
    background-color: #4752c4;
}

.action-btn:disabled {
    background-color: #4f545c;
    cursor: not-allowed;
    opacity: 0.7;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 300px; /* Match canvas width */
}

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

.control-btn {
    width: 60px;
    height: 60px;
    background-color: #4f545c;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s;
    /* Disable touch selection */
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.control-btn:active {
    background-color: #40444b;
    transform: translateY(2px);
}

.control-btn svg {
    fill: currentColor;
}

.hidden {
    display: none;
}

.popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1f2125;
    color: #ffffff;
    border-radius: 10px;
    width: min(90vw, 360px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 1001;
    padding: 16px;
    border: 1px solid #2d3136;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.popup-title {
    font-size: 1.1rem;
    margin: 0;
}

.popup-close {
    background: transparent;
    color: #c1ccd3;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 6px;
}

.popup-body {
    color: #c1ccd3;
    font-size: 0.95rem;
    margin-bottom: 14px;
    line-height: 1.4;
}

.popup-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.popup-ok {
    max-width: 120px;
    padding: 8px 14px;
}

.popup.success {
    border-color: #2f9e44;
}

.popup.error {
    border-color: #d9480f;
}

/* Mobile Responsiveness */
@media (max-width: 350px) {
    .user-info-bar {
        padding: 8px 12px;
    }
    
    .user-name {
        font-size: 0.8rem;
    }
    
    .logout-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    canvas {
        width: 260px;
        height: 260px;
    }
    .controls {
        width: 260px;
    }
    .control-btn {
        width: 50px;
        height: 50px;
    }
}
