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

body {
  overflow: hidden;
  font-family: Arial, sans-serif;
  background: #f0f0f0;
  height: 100vh;
  width: 100vw;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  min-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  text-align: center;
}

.modal-content h2, .modal-content h3 {
  margin-bottom: 12px;
  color: #333;
}

.modal-content p {
  margin-bottom: 16px;
  color: #666;
}

.modal-content input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.modal-content input[type="text"]:focus {
  border-color: #4a90d9;
}

.modal-content button,
.modal-btn {
  margin-top: 12px;
  padding: 10px 24px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-btn.secondary {
  background: #999;
}

.modal-content button:hover,
.modal-btn:hover {
  background: #357abd;
}

.modal-btn.secondary:hover {
  background: #777;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.or-divider {
  margin: 12px 0;
  color: #999;
  font-size: 14px;
}

/* Toolbar */
.toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 4px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.toolbar.hidden {
  display: none;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.separator {
  width: 1px;
  height: 28px;
  background: #ddd;
  margin: 0 6px;
}

.spacer {
  flex: 1;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: all 0.15s;
}

.tool-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.tool-btn.active {
  background: #e3f0ff;
  color: #4a90d9;
}

.tool-btn.danger:hover {
  background: #fee;
  color: #d44;
}

.style-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.style-btn.active {
  background: #e3f0ff;
  border-color: #4a90d9;
  color: #4a90d9;
}

.style-btn:hover {
  background: #f0f0f0;
}

/* Toolbar inputs */
.toolbar input[type="color"] {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px;
}

.toolbar input[type="range"] {
  width: 80px;
  cursor: pointer;
}

.toolbar input[type="number"] {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

.toolbar select {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  max-width: 130px;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
}

#brushSizeLabel {
  font-size: 11px;
  color: #888;
  min-width: 30px;
}

#zoomLevel {
  font-size: 12px;
  color: #666;
  min-width: 40px;
  text-align: center;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #4a90d9;
}

.user-count {
  background: #4a90d9;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
}

/* Canvas */
#canvas {
  position: fixed;
  top: 48px;
  left: 0;
  width: 100vw;
  height: calc(100vh - 48px);
  cursor: crosshair;
}

/* Text input overlay */
.text-input-overlay {
  position: fixed;
  z-index: 200;
  min-width: 100px;
  min-height: 30px;
}

.text-input-overlay .rich-editor {
  border: 2px dashed #4a90d9;
  background: rgba(255,255,255,0.9);
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
  min-width: 100px;
  min-height: 30px;
  max-width: 600px;
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
}
