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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
}

.header {
    margin-bottom: 15px;
    padding: 0 10px;
}

h1 {
    color: #333;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.thickness-control {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #666;
    font-size: 0.9em;
}

.thickness-control label {
    font-weight: bold;
}

.thickness-control input[type="range"] {
    width: 200px;
}

.thickness-control #thicknessValue {
    min-width: 30px;
    text-align: center;
    font-weight: bold;
}

#gameCanvas {
    border: 3px solid #667eea;
    border-radius: 10px;
    background: #FFFFFF;
    display: block;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.controls {
    margin-top: 15px;
    color: #666;
    font-size: 0.9em;
}

.controls p {
    margin: 5px 0;
}

/* Weapon Sidebar */
.weapon-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    background: #888;
    border-radius: 10px 0 0 10px;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    z-index: 1000;
}

/* Left Sidebar */
.weapon-sidebar.left-sidebar {
    right: auto;
    left: 0;
    border-radius: 0 10px 10px 0;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
}

.weapon-sidebar.left-sidebar.collapsed {
    transform: translateY(-50%) translateX(calc(-100% + 50px));
}

.weapon-sidebar.left-sidebar.collapsed .weapon-content {
    display: none;
}

.weapon-sidebar.collapsed {
    transform: translateY(-50%) translateX(calc(100% - 50px));
}

.weapon-sidebar.collapsed .weapon-content {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background: #666;
    border: none;
    border-radius: 10px 0 0 10px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -3px 0 10px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
    z-index: 1001;
}

/* Left sidebar toggle button */
.weapon-sidebar.left-sidebar .sidebar-toggle {
    left: auto;
    right: -40px;
    border-radius: 0 10px 10px 0;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
}

.weapon-sidebar.left-sidebar.collapsed .sidebar-toggle {
    right: 0;
    left: auto;
    border-radius: 0 10px 10px 0;
}

.sidebar-toggle:hover {
    background: #555;
}

.weapon-sidebar.collapsed .sidebar-toggle {
    left: 0;
    border-radius: 0 10px 10px 0;
}

/* Override for left sidebar when collapsed - ensure button is visible and clickable */
.weapon-sidebar.left-sidebar.collapsed .sidebar-toggle {
    left: auto !important;
    right: 0 !important;
    border-radius: 0 10px 10px 0;
    z-index: 1002;
}

.weapon-sidebar:not(.collapsed) .sidebar-toggle::before {
    content: '◀';
}

.weapon-sidebar.collapsed .sidebar-toggle::before {
    content: '▶';
}

/* Left sidebar arrow directions (reversed) */
.weapon-sidebar.left-sidebar:not(.collapsed) .sidebar-toggle::before {
    content: '▶';
}

.weapon-sidebar.left-sidebar.collapsed .sidebar-toggle::before {
    content: '◀';
}

.weapon-content {
    padding: 20px;
    color: white;
    transition: opacity 0.2s;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS/Safari */
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

/* Custom scrollbar styling */
.weapon-content::-webkit-scrollbar {
    width: 8px;
    -webkit-appearance: none;
}

.weapon-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.weapon-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    -webkit-appearance: none;
}

.weapon-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Fallback for Safari - ensure scrolling works */
@supports (-webkit-appearance: none) {
    .weapon-content {
        display: block;
        position: relative;
    }
}

.weapon-content h3 {
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.3em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.weapon-category {
    margin-bottom: 20px;
}

.weapon-category h4 {
    margin-bottom: 10px;
    font-size: 1em;
    color: #ddd;
    border-bottom: 1px solid #aaa;
    padding-bottom: 5px;
}

.weapon-item {
    padding: 10px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    user-select: none;
}

.weapon-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-3px);
}

.weapon-item:active {
    transform: translateX(-1px);
}

.color-item {
    padding: 10px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    user-select: none;
    border: 2px solid transparent;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.color-item:hover {
    transform: translateX(3px);
    border-color: rgba(255, 255, 255, 0.5);
}

.color-item:active {
    transform: translateX(1px);
}


