body {
    background-color: #1a1a1a;
    background-image: radial-gradient(circle at center, #2a2a2a 0%, #111 100%);
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app-layout {
    display: flex;
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: #222;
    border: 2px solid #444;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: 200px;
    background: #1e1e1e;
    border-right: 2px solid #333;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-card {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    border: 2px solid #555;
    background: #000;
}

.info {
    flex: 1;
}

.name {
    font-size: 14px;
    font-weight: bold;
    color: #ddd;
}

.score {
    font-size: 12px;
    color: #aaa;
}

.opacity-50 {
    opacity: 0.5;
}

/* Main Content */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
}

#game-header {
    height: 50px;
    background: #222;
    border-bottom: 2px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.game-logo {
    font-size: 18px;
    font-weight: bold;
    color: #ffcc00;
    text-shadow: 0 0 5px orange;
}

#game-timer {
    font-family: monospace;
    font-size: 20px;
    color: #fff;
    background: #000;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #444;
}

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

.btn-small {
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
}

.btn-small:hover {
    background: #444;
}

#game-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    position: relative;
    overflow: hidden;
    /* Consider removing this if it clips effects */
    /* Scrollbars handling */
}

canvas {
    border: 2px solid #444;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    /* Ensure canvas fits if screen is small */
    max-width: 100%;
    max-height: 100%;
}

/* Bottom Bar */
#bottom-bar {
    height: 60px;
    background: #1f1f1f;
    border-top: 2px solid #333;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

.stat-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2a2a2a;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #333;
}

.stat-icon {
    font-size: 18px;
}

.stat-value {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.divider {
    width: 1px;
    height: 30px;
    background: #444;
    margin: 0 10px;
}

.extras {
    display: flex;
    gap: 10px;
}

.extra-item {
    font-size: 24px;
    background: #2a2a2a;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #app-layout {
        flex-direction: column;
        height: 100vh;
        border: none;
        border-radius: 0;
    }

    #sidebar {
        display: none;
        /* Hide sidebar on small mobile for now */
    }

    #bottom-bar {
        padding: 0 10px;
        gap: 10px;
    }

    .stat-group {
        padding: 4px 8px;
    }

    #game-header {
        padding: 0 10px;
    }
}

/* Touch Controls */
#touch-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

#joystick-zone {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: auto;
    touch-action: none;
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

#bomb-btn {
    position: absolute;
    bottom: 40px;
    right: 40px;
    width: 80px;
    height: 80px;
    background: rgba(255, 69, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#bomb-btn:active {
    background: rgba(255, 69, 0, 0.8);
    transform: scale(0.95);
}

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

.modal-content {
    background-color: #222;
    margin: auto;
    padding: 20px;
    border: 1px solid #444;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    color: #eee;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

.modal-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.room-list-item {
    background: #333;
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #444;
}

.room-list-item:hover {
    background: #444;
    cursor: pointer;
}

.room-info {
    text-align: left;
}

.room-bet {
    font-size: 12px;
    color: #ffd700;
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    width: 100%;
}

.btn-primary:hover {
    background-color: #45a049;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px;
    background: #333;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
    box-sizing: border-box;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-btn:hover,
.close-btn:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

#game-over-modal {
    text-align: center;
}

.winner-text {
    font-size: 24px;
    color: #4CAF50;
    margin: 20px 0;
}