html, body {
  margin: 0; height: 100%; background: #fdf9f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-user-select: none; -ms-user-select: none; user-select: none;
  -webkit-touch-callout: none; overscroll-behavior: none; overflow: hidden;
}
#canvas-wrapper { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
canvas { display: block; position: absolute; top: 0; left: 0; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#gridCanvas { background: #fdf9f0; z-index: 1; }
#board { background: transparent; z-index: 2; }
#menu-container { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; position: relative; z-index: 100; }
.menu-box { background: white; padding: 24px 32px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); max-width: 400px; width: 90%; text-align: center; }
.menu-box h1 { margin-top: 0; color: #333; }
.menu-box button { width: 100%; padding: 12px; font-size: 16px; background-color: #007bff; color: white; border: none; border-radius: 8px; cursor: pointer; transition: background-color 0.2s; }
.menu-box button:hover { background-color: #0056b3; }
.menu-box button.secondary { margin-top: 10px; background-color: #6c757d; }
.menu-box button.secondary:hover { background-color: #5a6268; }
#board-list { margin-top: 20px; max-h: 40vh; overflow-y: auto; border-top: 1px solid #eee; padding-top: 10px; }
#board-list a { display: block; padding: 10px; background-color: #f8f9fa; margin-bottom: 8px; border-radius: 6px; text-decoration: none; color: #333; font-weight: 500; transition: background-color 0.2s, transform 0.2s; }
#board-list a:hover { background-color: #e9ecef; transform: scale(1.02); }
.loading-text { color: #888; font-style: italic; }
#whiteboard-container { display: none; }

/* Toolbar Styling - Unified Glassy Look */
#toolbar {
  position: fixed; top: 50%; left: 10px; transform: translateY(-50%);
  background: rgba(255,255,255,0.4);
  backdrop-filter: blur(2px);
  border-radius: 10px; padding: 8px 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  z-index: 10; transition: background-color 0.3s ease;
}

#toolbar button, .color { border: none; border-radius: 6px; cursor: pointer; transition: transform .12s ease, opacity 0.2s ease; }

/* Buttons always have the semi-transparent look until hovered/active */
#toolbar button {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.6;
  background: rgba(255,255,255,0.6);
}

#toolbar button:hover, .color:hover { transform: scale(1.07); opacity: 1; background: #f2f2f2; }

#toolbar button.active { opacity: 0.9; background: #007bff; color: white; }
#toolbar button.active:hover { background: #0056b3; }

.color { width: 24px; height: 24px; }
.color.active { outline: 2px solid #007bff; outline-offset: 2px; }
#colors { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }

/* Move Active State - Only hides specific elements now */
#toolbar.move-active #colors, #toolbar.move-active #lineWidthContainer { display: none; }

#lineWidthContainer { position: relative; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e0e0e0; }
#lineWidthToggle { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.6); border: none; border-radius: 6px; cursor: pointer; transition: transform .12s ease; padding: 0; }
#lineWidthToggle:hover { transform: scale(1.07); background: #f2f2f2; }
#currentWidthIndicator { display: block; background: #333; border-radius: 50%; }

/* Width Picker Menu Styling */
#lineWidths { position: absolute; left: 100%; top: -20px; margin-left: 10px; background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2); padding: 8px 12px; z-index: 20; display: none; flex-direction: column; align-items: center; gap: 8px; }
#lineWidthSlider { -webkit-appearance: none; appearance: none; width: 120px; height: 8px; background: #ddd; outline: none; border-radius: 4px; opacity: 0.9; transition: opacity .2s; }
#lineWidthSlider:hover { opacity: 1; }
#lineWidthSlider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; background: #007bff; cursor: pointer; border-radius: 50%; }
#lineWidthSlider::-moz-range-thumb { width: 18px; height: 18px; background: #007bff; cursor: pointer; border-radius: 50%; }
#lineWidthValue { font-size: 14px; font-weight: 500; color: #333; background: #f0f0f0; padding: 2px 6px; border-radius: 4px; }

/* Eraser Mode Toggle Styles */
#eraserModeContainer {
  display: none;
  width: 100%;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
  padding-bottom: 8px;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.eraser-mode-btn {
  flex: 1;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #eee;
  background: #f9f9f9;
  border-radius: 4px;
  cursor: pointer;
  color: #444;
  transition: all 0.2s;
}
.eraser-mode-btn:hover { background: #f0f0f0; }
.eraser-mode-btn.active { background: #e6f2ff; border-color: #007bff; color: #007bff; }

#rectifyBtn, #triangleToolContainer, #textInsertBtn, #pasteImageBtn, #duplicateBtn, #deleteBtn, #zoomControls { position: absolute; display: none; z-index: 20; }
#rectifyBtn, #triangleMenuBtn, #triangleSubmenu button, #textInsertBtn, #pasteImageBtn, #duplicateBtn, #deleteBtn, #magnifyBtn, #minifyBtn { width: 28px; height: 28px; padding: 0; display: flex; align-items: center; justify-content: center; border: 1px solid #ccc; background: white; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.1); border-radius: 6px; transition: transform .12s ease, background-color .12s ease; }
#rectifyBtn:hover, #triangleMenuBtn:hover, #triangleSubmenu button:hover, #textInsertBtn:hover, #pasteImageBtn:hover, #duplicateBtn:hover, #deleteBtn:hover, #magnifyBtn:hover, #minifyBtn:hover { background: #e9e9e9; transform: scale(1.07); }
#triangleSubmenu { position: absolute; left: 100%; top: -4px; margin-left: 6px; background: white; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); padding: 4px; display: none; gap: 4px; }
#zoomControls { display: flex; gap: 6px; }
.inlineTextInput { position: absolute; z-index: 50; background: transparent; border: none; outline: 1px dashed rgba(0,0,0,0.25); padding: 0; margin: 0; box-sizing: border-box; resize: none; overflow: hidden; line-height: 1.1; white-space: pre; font-family: 'Caveat', cursive; }

/* Move Tool Specific Zoom Controls */
#moveZoomControls { position: fixed; bottom: 20px; right: 20px; display: none; flex-direction: column; gap: 10px; z-index: 100; }
#moveZoomControls button { width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, 0.4); border: 1px solid rgba(0,0,0,0.1); color: rgba(0,0,0,0.7); font-size: 24px; font-weight: bold; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center; transition: transform .12s ease, background-color .12s ease, opacity 0.2s ease; backdrop-filter: blur(2px); }
#moveZoomControls button:hover { background: rgba(255, 255, 255, 0.8); transform: scale(1.05); color: #000; }