body, html {
    margin: 0; padding: 0; overflow: hidden;
    font-family: sans-serif; background-color: #f8f8f8;
}
*{
    border-radius: 5px;
}

/* --- MODIFIED: Canvas Stack --- */
#backgroundCanvas, #peer-canvas-container, #drawingBoard, #cursorCanvas {
    display: block; position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
}
#backgroundCanvas { z-index: 1; }

/* --- [NEW] Peer Canvas Container --- */
#peer-canvas-container { 
    z-index: 5; 
    background-color: transparent; 
    pointer-events: none; /* Pass clicks through */
}
/* This targets any canvas *inside* the container */
#peer-canvas-container > canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    image-rendering: pixelated;
}



/* ---------------------------------- */

/* --- [NEW] Class to hide the default cursor when drawing our own --- */
.no-cursor {
    cursor: none;
}

#drawingBoard     { z-index: 3; background-color: transparent; cursor: crosshair; image-rendering: pixelated; }

#cursorCanvas     { 
    z-index: 4; 
    background-color: transparent; 
    pointer-events: none; 
}

#toolbox {
    position: fixed;
    border: 0;
    right: 5px;
    background-color: rgb(0 0 0 / 16%);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
    top: 5px;
    flex-direction: column;
}
#participants-container {
	
}
#participants-toggle {
	border: none;
	background-color: #2ECC71;
	color: white;
	padding: 11px;
	cursor: pointer;
	box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

#participants-list {
    position: absolute;
    background: rgb(214 214 214);
    top: 0;
    right: 65px;
    width: max-content;
    padding: 10px;
}

#participants-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
#participants-list li {
    padding: 5px 8px;
    border-bottom: 1px solid #ddd;
    display: flex; /* For checkbox alignment */
    align-items: center; 
    gap: 8px; 
    
}

#participants-list li:last-child {
    border-bottom: none;
}
#participants-list li.me {
    font-weight: bold;
    color: #3498db;
}

/* --- [NEW STYLE FOR ROOM CODE] --- */
#participants-room-info {
    padding: 5px 8px;
    font-size: 0.9em;
    color: #555;
    border-bottom: 2px solid #bbb;
    margin-bottom: 5px;
}
.mute-btn{

	padding: 8px;
	border: navajowhite;
	border-radius: 50%;
	cursor: pointer;

}
/* --- [NEW STYLE FOR KICK BUTTON] --- */
.kick-btn {
	background-color: #e74c3c;
	color: white;
	border: none;
	padding: 8px;
	border-radius: 50%;
	cursor: pointer;
}
.kick-btn:hover {
    background-color: #c0392b;
}

.hidden {
    display: none;
}
.color-swatch {
	width: 24px;
	height: 24px;
	cursor: pointer;
	transition: transform 0.15s ease;
	padding: 8px;
}

.color-swatch:hover {  }

.tool-button, #background-selector {
	border: none;
	background-color: #555;
	color: white;
	padding:10px;
	cursor: pointer;
	font-weight: bold;
	transition: background-color 0.2s;
	font-family: sans-serif;
	font-size: 14px;
	max-width: 40px;
}
.tool-button:hover, #background-selector:hover { background-color: #444; }
#clear-button:hover { background-color: #c00; }
#eraser-button.active { background-color: #333; }

/* [NEW] Ensure shape icons are a good size */
#square-button i, #circle-button i {
    font-size: 18px;
}
#color-picker {
	width: 30px;
	height: 30px;
	border: none;
	cursor: pointer;
	border-radius: 5px;
	overflow: hidden;
	padding: 0;
}
#image-upload { display: none; }
#upload-label {
    background-color: #3498db; border: none; color: #fff;
    padding: 10px;
    cursor: pointer; font-weight: bold;
}
#upload-label:hover { background-color: #2980b9; }
.tool-group {
	display: flex;
	gap: 8px;
	font-size: 14px;
	
    
}
.size-button {
	border: 2px solid transparent;
	background-color: #fff;
	width: 36px;
	height: 36px;
	cursor: pointer;
    
	transition: all 0.2s;
	padding: 0;
	display: flex;
	justify-content: center;
	align-items: center;
}
.size-button > div {
    border-radius: 50%;
}
#toolbox > div {
	margin-left: auto;
}

/* --- [NEW] Styles for Collapsible Menus --- */

.selector-group {
    position: relative;
}

.selector-group .active-display {
    background-color: #555;
    color: white;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    
}
.selector-group .active-display:hover {
    background-color: #444;
}

.selector-group .expand-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.selector-group .options {
	display: none;
	position: absolute;
	top: -5px;
	transform: translateX(-105%);
	background-color: rgb(0 0 0 / 16%);
	padding: 5px;
	z-index: -1;
	gap: 5px;
	border-radius: 4px;
}

/* When a group is expanded, show its options and flip the arrow */
.selector-group.expanded .options {
    display: flex;
}
.selector-group.expanded .expand-arrow {
    transform: rotate(180deg);
}

/* By default, hide any size button that is NOT active, unless the container is expanded */
#size-selector:not(.expanded) .size-button:not(.active) { display: none; }

/* When the container is expanded, ensure all buttons are visible */
#size-selector.expanded .size-button {
    display: flex;
}
.size-button:hover { background-color: #eee; }
.size-button.active {
	border-color: #3498db;
	background-color: #eaf5fc;
}
.size-preview-line {
	background-color: #000;
	width: 80%;
	border-radius: 5px;
	pointer-events: none; /* Make it so the line doesn't intercept clicks */
}

/* Specific styles for the new groups */
#active-tool-icon {
    font-size: 18px;
    width: 20px; /* Match icon font size */
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#active-color-swatch {
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    box-sizing: border-box;
}
#lobby {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lobby-box {
    background: #fff;
    padding: 20px;
    
    text-align: center;
    width: 300px;
}
.lobby-box h2 {
    margin-top: 0;
}
.lobby-box input[type="text"] {
    font-size: 1.2em;
    padding: 10px;
    border: 1px solid #ddd;
    
    width: calc(100% - 24px); /* Full width with padding */
    margin-bottom: 15px;
}

input:focus {
    outline: none;
    border-color: #3498db;
}
.join-group > input[type="text"]{
    margin-bottom: 0;
}

.lobby-box .join-group {
    display: flex;
    gap: 10px;
}
.lobby-box .join-group input {
    flex-grow: 1; /* Input takes available space */
    margin-right: 0;
}

.lobby-box button {
    font-size: 1.2em;
    padding: 10px 15px;
    border: none;
    cursor: pointer;
    background-color: #3498db;
    color: white;
    width: 100%; /* Make buttons full-width */
}
.lobby-box .join-group button {
    width: auto; /* Override for join button */
}

#room-code-display {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    margin: 15px 0;
}
#lobby-status {
     margin-top: 15px; color: #555;
}
#start-session-btn {
    background-color: #2ECC71 !important;
    margin-top: 10px;
    display: none; /* Hidden by default */
}

/* --- [NEW] Canvas Dock Styles --- */
#canvas-dock {
	gap: 10px;
	position: fixed;
	left: 10px;
	bottom: 10px;
	right: 74px;
}
#dock-tiles-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
    /* [NEW] Allow horizontal scrolling when items overflow */
    overflow-x: auto;
    
}

#dock-tiles-list li {
	width: 90px;
	height: 70px;
	border: 1px solid #ccc;	
	cursor: pointer;
	background-color: #fff;
	overflow: hidden;
	position: relative;
	transition: border-color 0.2s;
	flex-shrink: 0;
}
#dock-tiles-list li:hover {
    border-color: #888;
}

#dock-tiles-list > li > img {
	position: absolute;
	top: -1px;
	left: -1px;
	width: 103%;
	height: 103%;
	object-fit: cover;
	object-position: center;
}

/* --- [NEW] Delete Canvas Button --- */
.delete-canvas-btn {
	position: absolute;
	top: 3px;
	right: 3px;
	width: 20px;
	height: 20px;
	background-color: #e74c3c;
	color: white;
	border: 0;
	
	cursor: pointer;
	font-size: 14px;
	font-weight: bold;
	line-height: 18px;
	text-align: center;
	z-index: 99;
	padding: 0 0 1px 1px;	
	display: none; /* Hide by default for everyone */
}

/* Only show the delete button on the active canvas tile. */
#dock-tiles-list li.active .delete-canvas-btn {
    display: block;
}

#dock-tiles-list li.active {
    border-color: #3498db;
    
}

#add-canvas-btn {
	flex-shrink: 0;
	background: #f3f3f3;
	color: black;
}
#custom-color-trigger {
    background-image: linear-gradient(to right, #A75B5B, #B8855F, #CCB988, #8E9C7E, #5D8291, #645D7E, #7A5C70);
}

/* --- [NEW] Custom Scrollbar for Dock --- */
/* This targets Webkit browsers like Chrome, Safari, Edge */
#dock-tiles-list::-webkit-scrollbar {
    height: 8px;
}

#dock-tiles-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

#dock-tiles-list::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}